15 replies [Last post]
cyberstudios
Offline
Regular
Last seen: 17 years 6 weeks ago
Joined: 2005-07-03
Posts: 32
Points: 0

I learned here some time back that declaring the correct Doctype is essential for predictable results with CSS, but is there a general declaration that we should be using? The reason I ask is because I've been building table-less pages for some time and declaring my html as :

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">

I'm beginning to get the hang of it and enjoying the greater precision which the use of divs brings - however I've recently found that I couldn't get formatted browser scroll bars (color, shadow etc) to work unless I declared the document as:

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">

Clearly I need a better understanding of document standards, any help would be much appreciated
Thanks!
Paul

Anonymous
Anonymous's picture
Guru

Re: Declaring Doctypes

cyberstudios wrote:
... I've recently found that I couldn't get formatted browser scroll bars (color, shadow etc) to work unless I declared the document as:

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">That is an incomplete doctype which is basically the same as no doctype at all. It puts your browser into quirks mode and allows deprecated and proprietary tags and css definitions to work.

Scroll bar colors and effects are IE only and should be avoided.

cyberstudios
Offline
Regular
Last seen: 17 years 6 weeks ago
Joined: 2005-07-03
Posts: 32
Points: 0

Declaring Doctypes

That's helpful, many thanks!
Paul

romanandrey
Offline
Regular
Los Angeles
Last seen: 15 years 49 weeks ago
Los Angeles
Joined: 2005-08-13
Posts: 33
Points: 0

Declaring Doctypes

Here's a nice primer on doctypes:

http://www.alistapart.com/articles/doctype/

(don't use XHTML 1.1 unless you want to be struck by lightning)

Anonymous
Anonymous's picture
Guru

Declaring Doctypes

romanandrey wrote:
(don't use XHTML 1.1 unless you want to be struck by lightning)
I have not yet seen a problem that points to the use of 1.1 but what do I know. Tongue

Hugo
Hugo's picture
Offline
Moderator
London
Last seen: 7 years 31 weeks ago
London
Joined: 2004-06-06
Posts: 15668
Points: 2806

Declaring Doctypes

Hmm, :roll: problems? no there are none as long as your prepared to serve the page correctly.

The sooner DocTypes become an irrelevance and no longer required the better, roll on that day.

Before you make your first post it is vital that you READ THE POSTING GUIDELINES!
----------------------------------------------------------------
Please post ALL your code - both CSS & HTML - in [code] tags
Please validate and ensure you have included a full Doctype before posting.
Why validate? Read Me

ClevaTreva
ClevaTreva's picture
Offline
Guru
A hilly place, UK
Last seen: 3 years 40 weeks ago
A hilly place, UK
Joined: 2004-02-05
Posts: 2902
Points: 0

Declaring Doctypes

Hi

I think the issue with 1.1 is that many html bits allowed in 1.0 have been removed, making it harder to migrate an old page to. Given that IE doesn't suport xhtml anyway, you lose the older html bits without gaining the newer xhtml bits. It's a lose-lose situation.

Trevor

Hugo
Hugo's picture
Offline
Moderator
London
Last seen: 7 years 31 weeks ago
London
Joined: 2004-06-06
Posts: 15668
Points: 2806

Declaring Doctypes

It's not meant to be used unless served up correctly; that means served as a proper xml parsed document - application/xhtml+xml, along with correct xml prolog etc.

1.0 is the only flavour that it has been deemed acceptable and permissable to serve up as text/html using the tag soup parser, although many would argue that in fact it should not be and unless your prepared to serve it properly then use html 4.01 strict.

1.1 is also only presentable in strict mode it does not rightly accept deprecated elements, regardless unless your actually making use of the eXtensible part of the language there is little point using XHTML, but that was all covered in the write up to help people.

We do go around in circles sometimes on certain subjects, thought this was established by now, it's been said so often on the forum.

Before you make your first post it is vital that you READ THE POSTING GUIDELINES!
----------------------------------------------------------------
Please post ALL your code - both CSS & HTML - in [code] tags
Please validate and ensure you have included a full Doctype before posting.
Why validate? Read Me

Anonymous
Anonymous's picture
Guru

Declaring Doctypes

Hugo wrote:
We do go around in circles sometimes on certain subjects, thought this was established by now, it's been said so often on the forum.
Yep, but I still see it used and served as text/html with no ill effects. Personally, I don't do it (as I see no point).

Hugo
Hugo's picture
Offline
Moderator
London
Last seen: 7 years 31 weeks ago
London
Joined: 2004-06-06
Posts: 15668
Points: 2806

Declaring Doctypes

There won't be ill effects as such, it's only a frigging Doctype, and is going to parsed by the tag soup engine if served incorrectly so it's all an academic argument .

It is surprising the number of people using 1.1 though, often one gets the impression that they ought to know better, and it especially bugs me when they are "professionals" working commercially. One really can earn a good living and not really know ones subject in this industry :roll:

Before you make your first post it is vital that you READ THE POSTING GUIDELINES!
----------------------------------------------------------------
Please post ALL your code - both CSS & HTML - in [code] tags
Please validate and ensure you have included a full Doctype before posting.
Why validate? Read Me

Anonymous
Anonymous's picture
Guru

Declaring Doctypes

Hugo wrote:
One really can earn a good living and not really know ones subject in this industry :roll:
Unfortunately, that's true. This "industry" is filled with Frontpagers and Crayola Kids, what do you expect? Wink Laughing out loud

thepineapplehead
thepineapplehead's picture
Offline
Moderator
Last seen: 15 weeks 4 days ago
Timezone: GMT+1
Joined: 2004-06-30
Posts: 9683
Points: 819

Declaring Doctypes

Hugo wrote:
The sooner DocTypes become an irrelevance and no longer required the better, roll on that day.

I'll get my coat . . . .

Verschwindende wrote:
  • CSS doesn't make pies

romanandrey
Offline
Regular
Los Angeles
Last seen: 15 years 49 weeks ago
Los Angeles
Joined: 2005-08-13
Posts: 33
Points: 0

Declaring Doctypes

romanandrey wrote:

(don't use XHTML 1.1 unless you want to be struck by lightning)

my explanation was simpler. Smile

Anonymous
Anonymous's picture
Guru

Declaring Doctypes

romanandrey wrote:
romanandrey wrote:

(don't use XHTML 1.1 unless you want to be struck by lightning)

my explanation was simpler. SmileYes, it appears that your mentioning it caused the Blitzkrieg! Laughing out loud

Hugo
Hugo's picture
Offline
Moderator
London
Last seen: 7 years 31 weeks ago
London
Joined: 2004-06-06
Posts: 15668
Points: 2806

Declaring Doctypes

blitzkrieg indeed, See one simple remark and the ranters are unleashed..er

Nice to see triumphs mastery of tongues again.

Before you make your first post it is vital that you READ THE POSTING GUIDELINES!
----------------------------------------------------------------
Please post ALL your code - both CSS & HTML - in [code] tags
Please validate and ensure you have included a full Doctype before posting.
Why validate? Read Me

Anonymous
Anonymous's picture
Guru

Declaring Doctypes

Hugo wrote:
Nice to see triumphs mastery of tongues again.
Bah, I can say "Hello" and "Where's the bathroom?" in 6 or 7 languages but that's about it. Wink