Greenguy's Board


Go Back   Greenguy's Board > Programming & Scripting
Register FAQ Calendar Search Today's Posts Mark Forums Read

 
 
Thread Tools Search this Thread Rate Thread Display Modes
Prev Previous Post   Next Post Next
Old 2007-01-22, 10:32 AM   #10
Licker4U
Mean people suck, nice people swallow, are you mean or nice?
 
Licker4U's Avatar
 
Join Date: Sep 2003
Location: Lower Alabama-The Redneck Riviera
Posts: 2,377
Send a message via ICQ to Licker4U Send a message via AIM to Licker4U
Quote:
Originally Posted by Simon View Post
If you're using a DOCTYPE that says "XHTML" in it, your validators will tell you that you should close certain html tags. From an explantion on the DigitalPoint forums...

XHTML is html reformulated as xml. XML requires that all tags be closed. Some tags in html are empty, that is they are replaced by whatever they're tagging. For example the <img> is replaced by the actual image, <br> is replaced by a line-feed, and <hr> is replaced by a horizontal line. These tags have no closing tag in html.

XML allows a short-hand for empty elements, the /> mechanism; thus, <br/>. That's good for xhtml, but invalid for html. HTML does allow it, though, if there is a space before the virgule, /. So <br /> fulfills the xml requirement, while being html valid. Using something like <br></br> would be invalid, as the closing tag is prohibited, and <br><br /> is redundant in html and invalid in xhtml.

Also, XHTML is based on XML, so it's much stricter about some other things, like:

- all elements and attribute names must appear in lower case
- all attribute values must be quoted
- non-Empty Elements require a closing tag
- empty elements are terminated using a space and a trailing slash
- no attribute minimization is allowed
- in strict XHTML, all inline elements must be contained in a block element


Personally, I prefer to use HTML 4.01 Strict since the real advantages of XHTML are only available if you serve the pages as ‘application/xhtml+XML’ . If you serve the pages as text/html (which almost everyone does), you may as well be coding in HTML. Documents served as 'text/html' will not be processed as XML, which means that web browsers will not render your pages as XHTML, but rather as HTML and will fall back on error handling and trying to guess how it was meant to be anyway.

Plus, if you do try to serve your pages as ‘application/xhtml+XML’ then Google AdSense and some scripting will not work. For example, document.write, innerHTML (for AJAX), and others.

More on why not to use XHTML here.

I'm sure there are some good reasons why some folks do like to use XHTML and I'll be glad to read about some of those if anyone would like to post about them here.
Well, that explained that |confused| I'll take your word for it.

Another CSS question: If I use CSS to set a border around an image of say, 2px, do I still need to put border="0" in the line where I set the image width, height, etc? Seems pointless but I saw it done that way on someone's site.
Licker4U is offline   Reply With Quote
 

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 06:35 PM.


Mark Read
Powered by vBulletin® Version 3.8.1
Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
© Greenguy Marketing Inc