View Full Version : html --> xhtml questions
mcgarry
Jan 29, 2005, 11:58 PM
I just converted my homepage (http://www.danmcgarry.com) to xhtml 1.0 Strict. I have a few questions, though:
- My pages are very simple. Should they include an XML declaration, such as
<?xml version="1.0" encoding="iso-8859-1"?>
or not? I don't really understand the pros and cons. Reading some stuff about it on this page sort of scared me off of it:
www.hut.fi/u/hsivonen/doctype.html
- if my page includes each of these lines:
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
and
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
Is that redundant, and is that good or bad in terms of cross-browser compatibility? Beyond what I can test, is there a best way to do this?
Thanks again for your help.
And by the way, as per my last question in this forum, I was bedeviled by MS's lack of support for "position: fixed" in my stylesheets. I didn't particularly like any of my workaround options, so I disabled my fancy (by my standards) fixed CSS side menus... for now. I may go with one of the workarounds or just go frames someday soon.
snkTab
Jan 30, 2005, 12:52 AM
Is that redundant, and is that good or bad in terms of cross-browser compatibility?
These are my related lines of xhtml.
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">
<head>
<meta http-equiv="content-language" content="en-us" />
<meta http-equiv="content-type" content="text/html; charset=iso-8859-1" />
Technically if your document is XHTML-strict then it can be read perfectly in any browser anyway so even all three lines become redundant. Yes it is redudant to say it's in english/western alphabet 4 times. That said, I would take away the xml line. This is because "they" want to make xhtml compatable with xml (which always has that line.) As far as everything else, they don't "exactly have to be there but feel free to leave them in their for form.
and remember as long as your code (without extra metadata) is coded using xhtml-strict rules these lines of code
<?xml version="1.0" encoding="iso-8859-1"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">
<head>
<meta http-equiv="content-language" content="en-us" />
<meta http-equiv="content-type" content="text/html; charset=iso-8859-1" />
is the same as this
<html><head>
mcarvin
Jan 30, 2005, 01:41 AM
One thing to remember is that IE6/Win enters "quirks" mode when the XML prologue (<?xml version="1.0" encoding="iso-8859-1"?>) is present. Google says: XML Prolog IE6 (http://www.google.com/search?q=XML%20prolog%20IE6)
Omitting the prolog puts it in standards mode and helps ensure more consistent rendering. Just for good measure, I throw Dean Edwards' IE7 (http://dean.edwards.name/ie7/) script in, and it's proven worthwhile.
mcgarry
Jan 30, 2005, 05:20 PM
Thanks for the tips.
I have looked at that IE7 page, and I think that may come in handy. At the moment, my site has been sufficiently dumbed-down that even IE6 can read it with no serious issues.
Looking at a page like mine, I never would have guessed IE would behave so funny ...
By the way, the main www.microsoft.com page and a couple others I checked don't even have doctype declarations. www.microsoft.com/mac returns 116 errors from validator.w3.org! I like the idea of standards, but when is MS going to get with it? (by the way, www.apple.com's pages don't do so well either, but their Safari product's a wee bit less important than IE right now) Until MS gets onboard, or Firefox/whatever takes over, getting your website to validate doesn't seem to ensure all that much. Even www.spreadfirefox.com returns 69 errors! (www.mozilla.org validates) I know I'm jumbling a lot of big issues here, I guess I'm just a little disappointed in the standards-loving community's ability to make anyone else follow them... I'm assuming standards are a good thing, but I don't know. I know I'm new to a very old discussion, and have a lot to learn.
On another note, when I looked at my site running on Win98, 2k, and xp machines I noticed how jagged the text looked. Besides turning my text into graphics, is there something I can do about this? I tried a couple different sans-serif font choices. Am I just spoiled by OS X's font-smoothing?
Sorry for the rants ...
Now, where do I go to enter my site in the Worst-Looking,-Most-Ridiculously-Basic-Site-that-Still-Happens-to-Validate-as-XHTML-1.0-Strict contest? It's in the bag!
snkTab
Jan 31, 2005, 11:28 PM
When it comes down to it, noone really cares if the website they are viewing is validated. Mostly because you can make a website that works perfectly in half the time without validating. A lot of stuff that doesn't validate is perfectly valid and might be good too. For instance height tags in some areas. While compliant html/xhtml wants you to move this to css is still is important for browser to maybe have this in here. I mean, it works in all browsers it's intuitive that if you have a width specification then you should have a height specification.
mcarvin
Feb 1, 2005, 01:53 AM
When it comes down to it, noone really cares if the website they are viewing is validated. Mostly because you can make a website that works perfectly in half the time without validating. A lot of stuff that doesn't validate is perfectly valid and might be good too. For instance height tags in some areas. While compliant html/xhtml wants you to move this to css is still is important for browser to maybe have this in here. I mean, it works in all browsers it's intuitive that if you have a width specification then you should have a height specification.
It's a good point that most people don't know squat from validation and therefore don't really care about it. The best reason for validating is bug fixing. I've helped other designers track down real PitA bugs just by running the validator on it.
Also, a valid page helps make sure that the page is future-proofed. Think like 2 years ago when there was no Firefox and the closest a Gecko engine came to mainstream was Netscape 6 (ugh). Now we're spoiled with mature Gecko and KHTML browsers that are way superior to MS' Trident engine. Who knows what the browser landscape will be 2 years from now. IE 7? XHTML 2.0 strict? Being valid now will help you then.
And you have a good point about making a non-valid site in half the time. However, after a couple of sites authored valid, I found that I was getting faster at authoring and encountered fewer and fewer validation errors. It's just a short learning curve, nothing more.
mcgarry
Feb 1, 2005, 02:15 AM
When it comes down to it, noone really cares if the website they are viewing is validated. Mostly because you can make a website that works perfectly in half the time without validating. A lot of stuff that doesn't validate is perfectly valid and might be good too. For instance height tags in some areas. While compliant html/xhtml wants you to move this to css is still is important for browser to maybe have this in here. I mean, it works in all browsers it's intuitive that if you have a width specification then you should have a height specification.
I agree with you, definitely; but as for my lament, by "anyone else" I meant the people making, not just using, browsers ... that's why I mentioned MS, Apple, and Mozilla. I should have been more clear, but I'm sure they too have good reasons not to care.
WoD
Feb 10, 2005, 06:57 AM
If only all existing browsers could be forced to support only XHTML 1.1- that would get some people out of the 80s and into the... TWENTY FIRST CENTURY!
The benefits of using semantically correct XHTML 1.1 with completely separated visual styling completely outweigh the pointless ease and cross-compatibility of tables. It is important to know that tables were NEVER intended to be used as a layout device in the first place, but it looks like we learnt the hard way.
Laying out sites in CSS is comfortably more fun and challenging that producing a whole crapload of nested tables in dreamweavers handy dandy WYSIWYG view.
If your pages are "very simple" then you are probably on the right track, an unstyled modern website should be nothing more than a few headers, paragraphs and lists grouped logically into divs, and maybe a few layout divs thrown in for good measure. Unfortunately it looks like you are using tables for layout. Two columns in a modern layout are <div></div><div></div>- the old way: <table><tr><td></td><td></td></table>, both take a little CSS to get the formatting, but the right choice is obvious from this example alone!
rendezvouscp
Feb 10, 2005, 05:56 PM
I really strive to meet standards (ha, not on my current site...it was more of a "get a product out the door before people start yelling) because it's one more page (or, many more pages) on the internet that is clean. Standards are the way web pages are supposed to be, and I'm a huge believer in doing the right thing. Which is why I'm very happy that the next version of my website is (currently) returns no errors in XHTML Strict.
Hacks are great and all, but in the end they just take up more time that could be used making great new features in website. C'mon Microsoft, get it together! Hopefully they'll get the Longhorn version of IE right, but does anyone know what they're doing with IE?
-Chase
vBulletin® v3.8.6, Copyright ©2000-2012, Jelsoft Enterprises Ltd.