Jump to content

Question Of Order


sphinxvc

Recommended Posts

I'm sure that there have been hundreds of threads of this type but since I didn't see any at first glance, I decided to post this. Any input is good input. So...I've been learning HTML for the past week or so, and I've also been able to put up a real basic html site with an external CSS style sheet. I figured the natural progression of my web development efforts would lead me to more in-depth CSS. Well, it turns out you should have/need a working knowledge of XHTML to really get into style sheets, this is what was recommended to me. I get that the basic difference between XHTML & HTML is a matter of syntax, so for those of you that have been down this road, should I first get comfortable with XHTML and then move onto CSS or does it not really matter?

Link to comment
Share on other sites

XHTML and HTML are the same thing, basically. Just choose to code your pages with one or the other and stay with it. You can learn CSS just fine without knowing XHTML. But XHTML is so similar to HTML that I don't see why one wouldn't learn it.The basic differences that XHTML has are:

  • The <html> tag needs the xmlns attribute: <html xmlns="http://www.w3.org/1999/xhtml">
  • All tags have an end tag: <img> to <img />, <link> to <link />, <br> to <br />...
  • All tags and attributes are lowercase: <DIV> to <div>, <a HREF="URL"> to <a href="URL">...
  • The characters & and < must be substituted with & and <. It's a good practise to do this with HTML, too.

Link to comment
Share on other sites

Guest FirefoxRocks

To convert an XHTML document to an HTML document, you just follow these steps: http://en.wikipedia.org/wiki/HTML#SGML-bas..._XML-based_HTMLTo convert an HTML document to XHTML, there are more steps that you need to take (quotes around attributes, CDATA sections on scripts, lower case tags, etc).CSS is independent of XHTML, XML or HTML. I used to prefer XHTML but with the upcomign HTML 5 I have migrated some pages to HTML5 and some to HTML 4.01 for the time being.

Link to comment
Share on other sites

If you're unsure which one to use, go with XHTML. I think the fact that it forces you to explicitly close tags and work in lower case for tags and attributes makes for cleaner looking markup. Though this is just my personal opinion/preference.

Link to comment
Share on other sites

XHTML and HTML are the same thing, basically. Just choose to code your pages with one or the other and stay with it. You can learn CSS just fine without knowing XHTML. But XHTML is so similar to HTML that I don't see why one wouldn't learn it.The basic differences that XHTML has are:
  • The <html> tag needs the xmlns attribute: <html xmlns="http://www.w3.org/1999/xhtml">
  • All tags have an end tag: <img> to <img />, <link> to <link />, <br> to <br />...
  • All tags and attributes are lowercase: <DIV> to <div>, <a HREF="URL"> to <a href="URL">...
  • The characters & and < must be substituted with & and <. It's a good practise to do this with HTML, too.

Thanks, I'll just use those basic practices for now and look into details of xhtml later on..but reading your post I had another question, what's the purpose of the xmlns attribute exactly? It looks like it has the same role as the !Doctype did in html, does xhtml not have a doctype declaration?
Link to comment
Share on other sites

so someone pointed that HTML5 might be coming out soon, so is there any need to write in XHTML? If the differences between it and HTML are just those few simple markup changes and some deprecated tags, why wouldn't they focus more on XHTML? Or do you have to keep revising HTML to even make XHTML relevant?

Link to comment
Share on other sites

Thanks, I'll just use those basic practices for now and look into details of xhtml later on..but reading your post I had another question, what's the purpose of the xmlns attribute exactly? It looks like it has the same role as the !Doctype did in html, does xhtml not have a doctype declaration?
The xmlns attribute is used to define Namespaces[/i] in XML. This is useful when you want to apply other XML technologies into your XML document. The namespace tells the browser how to interpret the given XML.
There are no elements that are deprecated in XHTML and not in HTML. There is no difference in that aspect. The elements that had been deprecated in HTML 4.01 continued to be deprecated upon the release of XHTML 1.0. It needs to be stressed that XHTML is not a more "correct" version of HTML.The purpose of XHTML was to allow the use of XML technologies in HTML documents. Internet Explorer hasn't been supporting XHTML up to now so it has hardly been useful.It doesn't matter whether you focus on HTML or on XHTML. HTML 5 isn't going to be around for quite a while. HTML 4.01 and XHTML 1.0 are exactly alike when it comes to functionality, there is nothing that one can do that the other doesn't (when you're developing cross-browser, anyways).I use HTML because I find it useless to develop XHTML when I'm sending a text/html MIME type to the browser.
Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...