Forum Moderators: open

Message Too Old, No Replies

XHTML Strict Tutorials

Wanting to learn

         

Aberdeen

2:54 am on Nov 21, 2004 (gmt 0)

10+ Year Member



I can write sites in XHTML transitional, but I want to try writing them in XHTML strict.

Can someone point me to some good tutorials, which explain the differences from transitional, and benefits etc.

I am finding it surprisingly hard to find.

Cheers

BonRouge

10:00 am on Nov 21, 2004 (gmt 0)

10+ Year Member



Not a great answer - I don't know any good tutorials off hand - but the basic difference is that with a strict declaration, you have to take all of the extraneous mark-up out of the html. I mean things like <font>, <b>, <div align="center">. These are all kind of style things. Style should actually go in your style sheet. I guess you should be left with basically raw data without the style sheet.
The benefits, I guess, are that you your html looks a lot cleaner and less confusing and that it's much easier to restyle something (especially site-wide) as everything (all the style info) is together.

I'm no expert, but what I would do, if I were you, is simply give your page a strict DTD and then put it through the w3c validator. You'll probably be shocked when you see all the errors it throws up at you and it'll probably take a while before you've cleared them by putting your style into a style sheet, but it's a liberating thing.

Good luck.

(While writing this, I thought I should maybe check that my site is still valid and I put it (well, the homepage at least) through the w3c validator. It threw one error at me - 'there is no attribute 'border''. I don't even remember adding 'border' anywhere in my page. D'oh!)

encyclo

3:33 pm on Nov 21, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



The fundamental difference between a transitional and a strict DTD is related to "deprecated" elements in the specification.

Earlier HTML specifications such as 2.0 or 3.2 included presentational elements and attributes alongside the more traditional structural ones.

With the advent of HTML 4.0 and later XHTML 1.0, the W3C wanted to discourage the use of presentational markup in favour of using CSS for the presentation instead.

In order to facilitate the transition, they made two different flavours of each specification: the first was called "Strict", which included only the structural parts of the specification. "Transitional" was (as the name implies) created to facilitate that transition, when older documents could validate to the new standard with little change. (There exists a third variety, Frameset, which is for framed documents only).

"Deprecated" has two distict real-world meanings. The first is the same as "not recommended": as the idea is to promote CSS for presentation rather than (X)HTML. The second meaning is that deprecated elements and attributes are marked for removal from a future specification. The first reason is entirely reasonable: reducing your use of presentational HTML can improve accessibility, markup portability and reduce weight. The second is rather irrelevant: the W3C has stopped all work on both HTML and XHTML 1.x, favouring the creation of a new markup language, XHTML 2.0, which would be incompatible with XHTML 1.x and HTML 4. So, there are no future versions planned where they could be removed.

So, which standard to choose? Using a Strict DTD can help in separating structure from style and producing a cleaner, more coherent document. However, don't fall into the trap of believing that the deprecated elements in the Transitional DTD are going to suddenly disappear in the future, and don't sacrifice your site's usability or functionality just to validate to a strict DTD. Use Strict if you can, but use Transitonal when required.

Robin_reala

10:19 pm on Nov 21, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



I found that the easiest way to find out what had been changed was to change a couple of my pages to strict doctypes and revalidate.

tedster

10:20 pm on Nov 21, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Here's a quick list of deprecated tags and attributes that might help you get started with strict mark-up (with or without the "X")

[webmasterworld.com...]

Aberdeen

2:47 pm on Nov 22, 2004 (gmt 0)

10+ Year Member



Thank you very much for your help

Aberdeen

3:21 am on Nov 23, 2004 (gmt 0)

10+ Year Member



Well I took the plunge and changed the doctype over to strict, and ...

All pages validated first time.

Maybe I do know what I am doing!

Thanks again for your help