Multiple CSS Styles Within Article
I'm writing some articles that include code listings that I want to be styled differently from the body text. I've set up a style sheet to achieve this. The article template I'm using assumes that the code listing is contained within the extra1 field and styles it accordingly. The problem is that when I preview the article, CityDesk is opening a paragraph before the extra1 field, which means that the code listing is getting the appearance of the body text because I've defined attributes for the paragraph tag in my style sheet.
I'm not sure that I really understand the question, but here's a suggestion. Instead of using an external style sheet, use a <div> tag to enclose the code sample. Within the <div> tag, include a "style=" attribute that contains the particular style elements that you want to apply to the code sample.
Use class selectors instead of just HTML selectors. Basically, in your stylesheet, have:
I am actually using class selectors. I'm finding that CityDesk is adding a new paragraph tag before inserting extra1, which is negating the use of my codelisting selector from the template. Looks like I'll just have to edit the HTML manually. Thanks anyway.
All of the fields in an article (body, extra1, extra2, etc) have an annoying (to me) feature. If the field contains no carriage returns, it doesn't get surrounded by <p></p> tags when you include it in a page. If it contains at least one carriage return, each paragraph in the field gets surrounded by <p></p> tags.
Darren, I think I have a situation similar to what you describe. In my case, I want to fill various CD fields with information for future conferences (venue, contact person, city, etc.)
Joel C. Goldstick
My markup in the last post has neglected to show the end of the style block. </style> should be placed before the div tag. oops.
Joel C. Goldstick
The way I usually work around this paragraphing problem is to use Shift-Enter instead of Enter at the end of each line. This inserts a <br> tag instead of a carriage return, so your field doesn't get <p></p> tags inserted into it.
Fog Creek Home