Categories
Programming

Porting to XHTML

I’m strongly thinking about porting this blog back into XHTML (same design, new code). Granted I loose you “older browser” fellows.

So my questions are as follows:

1. To go Xhtml or not?

2. If stay with HTML 4.01… how to make the page smaller, keep it valid, and retain all contents and formatting.

3. Just post less on the home page, so the page size is smaller?

4. Leave as is?

Please comment by the comments link below or email if you prefer.

6 replies on “Porting to XHTML”

XHTML is really no different from HTML 4.01. In fact, XHTML is illegaly rendered in Mozilla as HTML instead of XML, so there is definitely no difference. You can still write XHTML complaint code (without trailing slashes in empty tags like of course), but give it an HTML DTD. You can make the page smaller by using CSS. I’m not sure what XHTML has to do with it.

One of your fellow Moz bloggers, Gemal perhaps, wrote an excellent article about why XHTML-valid pages shouldn’t be published. And they certainly shouldn’t have a .html extension and be served up as text/html!

Either way, you won’t lose any users between HTML 4.01 and XHTML 1.1. They’re minor cosmetic differences that IE ignores easily.

There are several issues here:

1. Moving to a cleaner, CSS-styled layout. You could do this with HTML 4.01 Strict easily enough. (It’s what I’ve done on my blog, for instance.)

2. Authoring in XHTML. It’s probably a good idea to write content in XHTML so that you don’t need to back-convert it all later when you do switch to XHTML. This is probably a good idea as well (and also what I do on my blog).

3. Serving content in XHTML. Inasmuch as doing it properly (that is, with an application/xhtml+xml MIME type) will break every non-Mozilla (and maybe Safari?) browser, this is almost certainly a bad idea.

If I were you, I’d first modify my blog to use a clean, HTML 4.01 Strict, CSS-styled layout; then consider ways to author posts in XHTML and have them served as HTML.

I don’t think switching to XHTML will make the page any smaller; might as well just stay with HTML until XHTML is better-supported–and, of course, I mean HTML 4.01 Strict, and semantically-correct HTML 4.01 Strict at that. 🙂 The current page looks like a jumble of TABLE tags; switching to CSS would be the biggest help.

I seriously recommend to you going to http://www.sitepoint.com and purchasing their book (or downloading their sample chapters) “HTML Utopia: webpage layout using CSS”.

About xhtml, the question isn’t “why?” but “why not?”. If you serve your pages using the header “content-type: text/html; charset=iso-8859-1” there’s nothing wrong on it.

I use xhtml STRICT in my pages unless really proprietary tags are needed – then i use xhtml transitional.

So you could use HTML 4.01 strict and use CSS to get rid of those annoying font tags, or those obnoxious align / cellpadding / borderwidth attributes, which are what makes your webpage look UGLY from the inside out. Compare with the code at sitepoint.com that doesn’t have any nested tables.

Oh yeah! Don’t forget to download (elsewhere) the HTML TIDY utility and its windows frontend: Tidy UI. Saves LOTS of time.

Leave a Reply to Ricardo Garcia Cancel reply

Your email address will not be published. Required fields are marked *