Forum How do I...?

get my CSS colors to work?

TomDoes
No matter what I try, i'm not getting my css colors to work. They work when i open my page in the browser, however when i generate a PDF the color's don't show up.

I'm trying to color the background of a cell in a table and color some text.

This is my CSS

@page {
@top-left {
margin-top: 50pt;
content: flow(imageHeader);
}
@bottom-right {
content: counter(page);
font-style: italic
}
}

@page {
margin: 20pt 50pt 100pt 50pt
}

#reportInformation {
font-size: 12px;
}

#observerInformation {
margin-top: 20px;
font-size: 12px;
color: red
}

#explanationText {
margin-top: 20px;
font-size: 12px;
}

#imageHeader {
flow: static(imageHeader);
}

.blueCell {
background-color: #123456 !important;
width: 150px;
}
mikeday
Are the other rules applying, such as the font-size, margins, and @page rule? Or is the whole style sheet being ignored?
TomDoes
No the @page rule is working.. adding !important to colors and also adding the stylesheet through de javawrapper seems to do the trick. But it's strange behaviour..
mikeday
Perhaps there are other style sheets being applied, or the style attribute on elements?
TomDoes
Yes, there are other stylesheets, however when different browsers render it correctly it would expect the same of the pdf.
mikeday
Perhaps you could attach a test document. One possibility is the media type; Prince defaults to media "print" while browsers default to "screen". You can change this with the --media option on the command-line.
TomDoes
Ah great, the media option did the trick :)