Forum OpenACS Q&A: CSS and the loose.dtd

Collapse
Posted by Steve Manning on
Hi

I've been struggling around what I thought was an obscure problem with a style sheet on a page but which now turns out to be a problem with the default-master template.

Quite simply the doc type in the default-master references the loose.dtd as follows: <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">  This changes the behaviour of borders in the style sheet making them much thicker and quite ugly. I've stuck a couple of example pages up if anyone wants to see the effect: http://www.festinalente.co.uk/test/loose1.html and http://www.festinalente.co.uk/test/loose2.html

I've worked around this by creating my own master template without the reference to loose.dtd but I'm wondering if we need to have the reference in the default master any longer?

    Steve

Collapse
2: Re: CSS and the loose.dtd (response to 1)
Posted by Bart Teeuwisse on
Steve,

several web browsers render style sheets differently when the global DTD link is absent from the doc type of the page. To rule out any doc type ambiguity I would argue to always include the global DTD reference. Then modify the style sheet to get the look you want.

By global reference I mean http://www.w3.org/TR/html4/loose.dtd instead of a relative path like loose.dtd which is sometimes used.

/Bart

Collapse
3: Re: CSS and the loose.dtd (response to 2)
Posted by Steve Manning on
Bart

The problem is that the example I gave set the border width to 1 but the result when loose.dtd is playing is (on the browsers I've tried) much thicker than 1px. How do I get a thin border and still ref loose.dtd?

    Steve

Collapse
4: Re: CSS and the loose.dtd (response to 1)
Posted by Torben Brosten on
Have you tried "1px" instead of "1 1 1 1" for border-width value?  Maybe explicitly stating the unit will help rendering ambiguity here?
Collapse
5: Re: CSS and the loose.dtd (response to 4)
Posted by Steve Manning on
Yes that worked and I'm a puddin for not trying it. Fixed it here http://www.festinalente.co.uk/test/loose3.html

Still interesting to know the effect :)

Thanks

    Steve

Collapse
6: Re: CSS and the loose.dtd (response to 1)
Posted by Steve Manning on
Just got onto the wifes Windoze PC and tried this under IE5.5. IE renders the border thin in all cases so I suspect that was the designed response for loose.dtd. The thick border must be just a Gecko thing. Don't you just love CSS :)

Talking of strange behaviour, in my haste to knock out an example I used the English 'grey' for the background colour rather than the 'gray'. My Gecko based browsers where quite happy with this but IE displayed a white background until I 'corrected' the spelling. Its a funny world.

  Steve

Collapse
7: Re: CSS and the loose.dtd (response to 6)
Posted by Andrei Popov on
Mozilla by default assumes that 1 (without unit identifier) is in points, not pixels -- hence the border gets thicker.  IE makes its own assumptions, which in most cases are incorrect.

In fact, as stated by CSS2 spec, unit identifier is not optional : http://www.w3.org/TR/REC-CSS2/syndata.html#values