Ahh right I get it, thanks
-martin
| SitePoint Sponsor |

Ahh right I get it, thanks
-martin
Last edited by martin.christian; Jul 7, 2005 at 07:59.





xhtml is the new version of html. It's stricter code for markup. In html these tags:
Have to be closed in xhtml:Code:<br>
Also, all markup has to be lowercase and you can't leave width/height attributes off of image tags in xhtml like you can in html. Basically, just stricter code as I already said. Unless you specify a MIME handler, most browsers serve your xhtml as html.Code:<br />
DIV's refer to structuring your page with CSS. Like:
With accompanying CSS of course.Code:<div id="wrapper"> <div id="masthead"> <img> </div> <div id="maincontent"> <p>foo</p> </div> <div id="sidebar"> <a href="links.html">links</a> </div> <div id="footer"> <p>Thanks for visiting</p> </div> </div>



Just adding to what Rbutler said, Image tags also need to have an alt attribute attached.Originally Posted by rbutler
I specify my width and height in a CSS class.HTML Code:<img src="images/yourImageXHTML.jpg" alt="This is my awesome image" class="image1" />
CSS:
I will make one change to what was said before. the DOCTYPE needs to be all caps like this:Code:.image1 { width: 100px; height: 20px; border: 0px; }
There are more changes in XHTML that I havent listed however, below is a link to one of the better resources for learning XHTML:HTML Code:<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
http://www.w3schools.com/xhtml/xhtml_reference.asp
For your learning pleasure, I have a basic blank XHTML 1.0 Strict doc layed out for you:
Enjoy and if you need a hand you can always Message me.HTML Code:<!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" lang="en" xml:lang="en"> <head> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" /> <title>XHTML Strict Page</title> <link href="css/layout.css" rel="stylesheet" type="text/css" /> </head> <body> <!--Your site goes here--> </body> </html>


Wrong. It's a reformulation of HTML as an application of XML.Originally Posted by rbutler
Wrong. It's only a reformulation. It contains exactly the same things. It's neither stricter nor more semantic. Only different.Originally Posted by rbutler
That space is unnecessary in real XHTML.Originally Posted by rbutler
Wrong. There are no differences in what is required or allowed between XHTML 1.0 and HTML 4.01, with the corresponding DTD.Originally Posted by rbutler
Browsers don't serve markup, web servers do. And any browser that doesn't parse and treat text/html as HTML is severely broken and non-conformant.Originally Posted by rbutler
That is no different from HTML 4.01 Strict, though.Originally Posted by sputza
Birnam wood is come to Dunsinane
Actually, the BR element is closed in HTML aswell. It's an empty element type, which means that it must not have any content and no closing tag. Saying that "it has to be closed in XHTML" is no different from HTML; it has to be closed in HTML aswell, although it is closed implicity by the start tag.
An SGML parser knows that <br> is an empty element, because it is declared in the DTD.Code:<!ELEMENT BR - O EMPTY -- forced line break -->
Simon Pieters

Wrong, there are things in XHTML that are deprecated since HTML 4.01, and vice a versa, a few off the top of my head are applet, dir and strikethrough tags. They do differ in tags and properties.It contains exactly the same things.
Real XHTML 1.0 allows the use of text/html which means it is necessary in 'real XHTML'. XHTML 1.1 and Basic is another story however, as far as I'm aware anyway.That space is unnecessary in real XHTML.
It's good that you want to use XHTML (If you do, I can't see your orginal post), it allows for an easier transition in the future. For now, try and stick with XHTML 1.0, IE cannot parse XHTML as XML yet![]()
The DTDs for the Transitional variants of HTML 4.01 and XHTML 1.0 both cantain the <dir>, <strike>, and <applet> elements.
It is true that XHTML 1.0 (second edition) does add a few attributes like xmlns, xml:lang and the ID attribute to a few of the elements that aren't allowed to have an ID in HTML 4.01.
We are defining "Real XHTML" to mean non-HTML compatible XHTML served with a proper mime-type.
I can easily convert my well formed HTML 4.01 documents to XHTML 1.x with a few regular expressions.
We miss you, Dan Schulz.
Learn CSS. | X/HTML Validator | CSS validator
Dynamic Site Solutions
Code for Firefox, Chrome, Safari, & Opera, then add fixes for IE, not vice versa.



That is true.Originally Posted by AutisticCuckoo
This is the way I look at it, XHTML is newer and it’s the standard. Use it now or use it later... you will have to use it eventually.
What about if Web Applications 1.0 becomes HTML 5?
We miss you, Dan Schulz.
Learn CSS. | X/HTML Validator | CSS validator
Dynamic Site Solutions
Code for Firefox, Chrome, Safari, & Opera, then add fixes for IE, not vice versa.

So theoretically you don't mean 'real XHTML', you mean ideal XHTML. It would be incorrect of me to even say 'proper' when the specification explicitly says that text/html is allowed in XHTML 1.0.
I completely understand what you mean, and what you're getting at, but there are many that don't and we have to clarify for them, otherwise it can get confusing.





I wholeheartly disagree with that whole statement, but I'm not going into flame wars.Originally Posted by AutisticCuckoo
I didn't mention anything regarding doctype.Originally Posted by AutisticCuckoo
Sorry I missspoke, I meant web servers. I don't always say what I mean.Originally Posted by AutisticCuckoo
I don't want to start a flame war either, however, I would I appreciate it if you would explain why you think XHTML 1.x is more strict or more semantic and HTML 4.01.
We miss you, Dan Schulz.
Learn CSS. | X/HTML Validator | CSS validator
Dynamic Site Solutions
Code for Firefox, Chrome, Safari, & Opera, then add fixes for IE, not vice versa.


As Kravvitz said, 'real XHTML' means XHTML served as an application of XML, i.e. with a media type of application/xhtml+xml, application/xml or text/xml.Originally Posted by pauly
Anything served as text/html is HTML. <br /> in a document served as text/html is not XHTML; it's a <br> element followed by a greater-than sign (although virtually all browsers fail to parse it correctly).
It would be more correct to say that IE does not support XHTML at all yet. It can parse invalid HTML markup, which means you get away with using pretend-XHTML.Originally Posted by pauly
That's not entirely correct. The specification says that XHTML 1.0 that follows the guidelines in Appendix C of the specification may be served as text/html. They do not explicitly state that this means it is no longer XHTML, which I consider to be a major omission. The fact remains: anything served as text/html must be parsed and interpreted as HTML. Thus there is nothing 'wrong' with serving XHTML 1.0 as text/html, but you must realise that you are no longer using X(HT)ML and that you cannot use any of the features that XHTML offers over HTML (such as CDATA sections or elements from other XML namespaces).Originally Posted by pauly
You are 'allowed' to serve XHTML 1.0 markup as HTML. I'm not saying that it's wrong, but please stop spreading the lie that such a practice is somehow an improvement over HTML. It cannot be, since it is HTML.
And even when served as an application of XML, XHTML 1.x is not more strict and not more semantic than HTML 4.01 (with the corresponding DTD).
Birnam wood is come to Dunsinane
(FWIW, CDATA sections are allowed in HTML aswell, but currently only Opera 8 is able to parse it as CDATA, as far as I know.)
Simon Pieters

Come on now, we can't go throwing made up phrases about. 'Real XHTML' 1.0 allows the use of text/html. Yes it's recommended in XHTML that application/xhtml+xml be used, and requires you follow guidelines, but it still allows its use.As Kravvitz said, 'real XHTML' means XHTML served as an application of XML, i.e. with a media type of application/xhtml+xml, application/xml or text/xml.
In my case it is an improvement over HTML, because I both prefer it, and know it makes sense when it comes round to updating to application/xhtml+xml and being used in the future and with a future product currently under construction.I'm not saying that it's wrong, but please stop spreading the lie that such a practice is somehow an improvement over HTML. It cannot be, since it is HTML.
Developers have to learn sooner or later, and is currently not incorrect, so why not now? They'll have to update their documents eventually, might as well start some pre-planning - This includes using usual 'body style' property and attributes in the html style.
You have to bare in mind, XHTML is the web standard, meaning it's a stable W3C recommendation. XHTML is going to slowly replace HTML, so why is it more sensible to use HTML when you can use the web standard now, and have some reassurance it's going to work in the future without (To the current standard) having to update doctypes?





Because an html 4.01 doctype will allow you to get away with "things" that an xhtml strict doctype would not. Plus, you cannot tell me that this in html:Originally Posted by Kravvitz
Compared toCode:<img src="foo.jpg" WIDTH="400" HEIGHT="100">
The latter is not stricter by nature. XHTML doesn't allow the first, unless second unless seasoned developers have taught me completely wrong. To me, stating you have to use lowercase and supply all values is stricter than HTML 4.01. Can an individual still follow these rules in html 4.01? Yes, as they should but not everyone does. Again, this is it for me, this question was supposed to be a generic answer that got way out of hand and probably confused the original poster more than it helped, that's what I don't like about explaining myself in this way.Code:<img src="foo.jpg" width="300" height="200" alt="title">


Please, please, try to understand this: if you serve something as text/html it is HTML. You are no longer using XHTML. So it's completely absurd to say that 'XHTML allows the use of text/html.' What the XHTML 1.0 spec is saying is that until user agents support XHTML, you can pretend to use XHTML while serving it as HTML.Originally Posted by pauly
Something tells me that HTML support will not disappear within the foreseeable future, on account of there being a few billion HTML pages (and alleged XHTML pages that will fail miserably if served as an application of XHTML).Originally Posted by pauly
Last time I looked HTML 4.01 was also a valid recommendation. It's not deprecated, and it's the latest standard with any degree of user agent support worth mentioning, unless you're developing for niche markets where everyone uses Firefox or Opera (or possibly Safari).Originally Posted by pauly
Birnam wood is come to Dunsinane


An HTML 4.01 Strict doctype doesn't allow you to 'get away with' anything more than an XHTML 1.0 Strict doctype does. Some rules are different, but they are equally unambiguous and well-defined.Originally Posted by rbutler
The first is not valid HTML 4.01, because the alt attribute is required. The second one is valid HTML 4.01 Strict.Originally Posted by rbutler
Neither one is valid XHTML 1.0, since the <img> element is unclosed.
Neither does HTML 4.01. The 'alt' attribute is required, even in HTML 4.01 Transitional.Originally Posted by rbutler
So lowercase is stricter than uppercase? Your definition of strict is different from mine, then.Originally Posted by rbutler
Are you seriously saying that everyone who uses an XHTML doctype declaration writes clean, semantic markup that will work if the document is served as an application of XML? Please.Originally Posted by rbutler
![]()
Birnam wood is come to Dunsinane

Don't we all wish!unless you're developing for niche markets where everyone uses Firefox or Opera (or possibly Safari).![]()


I know I do...![]()
Birnam wood is come to Dunsinane
Bookmarks