Forum How do I...?

Css not getting applied to some divs

satyavati
Hi Mikeday,

I have found one more issue
Css are not getting applied on some divs.

This is not that the css is not getting applied to all divs means base urls are set

these are few css lines which we are appling :

.rcl-long{
border:1px solid #000; border-top:none; border-right:0px; width:135px; height:145px; float:left; padding:10px; background-color:#bdbec0;
}

.rcl-long p{
margin-top:55px;
}


.rclh-long{
border:1px solid #000; border-top:none; border-right:0px; width:135px; height:115px; float:left; padding:10px; background-color:#bdbec0;
}

.rclh-long p{
margin-top:25px;
}

.rcrh-long{
border:1px solid #000; border-top:none; width:468px; height:115px; float:right; padding:10px;
}
  1. Overlapping_css_not_applied.PNG8.2 kB
    pdf with css not applied so overlapping
  2. Overlapping_due_css_not_applied.PNG17.8 kB
    Html where overlapping is happening
  3. css_not_applied.PNG12.8 kB
    Image with css not applied
  4. html_with_css.PNG23.3 kB
    Html witj css
satyavati
What could be the reason for not getting css applied partially
mikeday
Can you set "background: aqua" or "color: green" on the div? If so, then the CSS is being applied.
satyavati
I added "color: green" the html got changed it is now showing the texts in green color but pdf did not change
The css is not getting applied on pdf
mikeday
How are you referring to the CSS file? Are there any error or warning messages appearing in the Prince output log?
satyavati
I have added the css through link tag eg.
<link href="style.css" rel="stylesheet" type="text/css" media="screen" />
<link href="print.css" rel="stylesheet" type="text/css" media="print" />

I am not getting any error in the output log
mikeday
print.css will be applied, and style.css will not be applied. If you specify --media=screen on the command-line then style.css will be applied and print.css will not be applied.
satyavati
:( Can't we apply both the css files
mikeday
Yes, just @import one from the other, or don't specify different media types for them, or apply them from the command-line.
satyavati
How can we apply media = screen in java program using prince

When I try to change the media from command then it gives following error

C:\Program Files\Prince\Engine\bin>prince --media = screen
prince: warning: failed to load external entity "screen"
prince: screen: error: could not load input file
prince: error: no input documents to process
mikeday
On the command-line it's "--media=screen" or "--media screen".

You can use setOptions("--media=screen") from the Java API.
satyavati
Thanks Mikeday the quick response

I tried @import and setOptions()

Both worked

But I am using @import css with no media