Cay Horstmann wrote:
> I am currently editing an XHTML document that makes heavy use of CSS.
> Many paragraphs have class attributes with values such as "Note",
> "Caution", etc. A style sheet is attached for pretty rendering.
> 
> However, editing in XXE was rather unintuitive since I could only tell
> the paragraph types apart by paying close attention to the Attributes
> table.
> 
> I was about to ask how to solve that problem, but I found it out myself.
>  Add this to addon/config/xhtml/css/xhtml.css
> 
> p:before {
>     content: attr(class) " ";
>     background-color: #eedd77;
>     font-size: smaller;
> }
> 
> Very impressive: The styled paragraphs are now prefixed by Note,
> Caution, and so on.
> 
> However, I'd like a small improvement. I'd like to not apply the style
> when there is no class attribute. (Right now, each paragraph without
> class attribute is preceded by a yellow space.) Is that possible?

Replace your CSS rule by this more precise one:

p[class]:before {
    content: attr(class) " ";
    background-color: #eedd77;
    font-size: smaller;
}

Reply via email to