Jump to content

Why SHOULD I use XHTML?


iyeru42

Recommended Posts

I've been wondering this since I first heard about XHTML a few years back. But what exactly does XHTML allow me to do that HTML cannot? (I can already create custom tags with CSS/HTML, it's not that hard. I also can use PHP on top of that to do preg_replace for any DB information.)

Link to comment
Share on other sites

  • Replies 68
  • Created
  • Last Reply

Top Posters In This Topic

The browser will not be happy though. There is nothing in any specification to tell a browser how to render a "tagger" element, or any other custom tag. The best you can hope for is that the browser just ignores them, the worst is that it screws up the rest of your page trying to handle something that shouldn't be there.You shouldn't send custom tags to the browser, if you want to embed things like that in a template and have a language like PHP process the template and convert those things to valid HTML that's fine, a lot of people do that, but you wouldn't want to tell the browser to try and render an element that it does not have a definition for. If you want to include extra data on the page but not have them show up, use a div or something and set the visibility to none.

Link to comment
Share on other sites

Most browsers render the tag as a blank HTML element, for example:

<tagger>Blah</tagger>

Says to most browsers (IE6, FF and NN all output this way):

<!-- Nothing Here -->

Without the comment of course. However, the HTML tag will STILL show in the source.

Link to comment
Share on other sites

Look, if you really need custom tags, use XML. Then, you can use XSLT to copy all standart elements as they are and turn your custom tags to something the browser might understand. You can practically match a whole page against a single XML tag. Look at AppML for instance. A few lines of XML code is taken by the ASP file and transofmed to a complete page, having tons of XHTML elements.The advantage of XHTML over HTML, at least in syntax's sence, is that you can use XML tools on it. For example, another XML, transformed by XSLT can use the document() function over that XHTML and pull something out of it. There are other advantages, but they require XHTML's MIME type (or the XHTML extension respectively), which however is not currently supported by IE.

Link to comment
Share on other sites

You should use XHTML when using an XML technology (language/code, software/program). XHTML is HTML in XML form. XML is a subset of SGML that is completely described in this document. Its goal is to enable generic SGML to be served, received, and processed on the Web in the way that is now possible with HTML. XML has been designed for ease of implementation and for interoperability with both SGML and HTML.

Link to comment
Share on other sites

Most browsers render the tag as a blank HTML element, for example:
<tagger>Blah</tagger>

Says to most browsers (IE6, FF and NN all output this way):

<!-- Nothing Here -->

Without the comment of course. However, the HTML tag will STILL show in the source.

Regardless of how many browsers do and don't mess the page up, what possible benefit would you get from putting your own tags on an HTML page? The sole purpose of HTML tags are to tell the browser to do something, so if you're not telling it to do anything then what's the point? Anything you are using that for I'm sure you can do with something else easier, and more valid.
Link to comment
Share on other sites

Most browsers render the tag as a blank HTML element, for example:
<tagger>Blah</tagger>

Says to most browsers (IE6, FF and NN all output this way):

<!-- Nothing Here -->

Without the comment of course. However, the HTML tag will STILL show in the source.

Quibble: I don't think most browsers will convert "<tagger>Blah</tagger>" to a comment. They'll usually display the word "Blah", so it would be the HTML equivalent of "<span>Blah</span>".
Link to comment
Share on other sites

note in the post you quoted

Without the comment of course. However, the HTML tag will STILL show in the source.
They were trying to say that it is ignored not that it produces a comment.
Link to comment
Share on other sites

Regardless of how many browsers do and don't mess the page up, what possible benefit would you get from putting your own tags on an HTML page? The sole purpose of HTML tags are to tell the browser to do something, so if you're not telling it to do anything then what's the point? Anything you are using that for I'm sure you can do with something else easier, and more valid.
That may be true, but if I add something like this:
TAGGER {	 margin:5px;	 font-family:Courier, serif;	 font-size:10px;	 color:#000;}

The browser would output it with a 5px margin, courier font face (serif) and a font-size of 10 pixels (#000 is usually the default for BODY tag. If not, TAGGER will inherit.)

Link to comment
Share on other sites

That may be true, but if I add something like this:
TAGGER {	 margin:5px;	 font-family:Courier, serif;	 font-size:10px;	 color:#000;}

The browser would output it with a 5px margin, courier font face (serif) and a font-size of 10 pixels (#000 is usually the default for BODY tag. If not, TAGGER will inherit.)

That's still no excuse. If you don't want any initial styling, use the "span" element. Giving some class to it, you can style it. For example:
<span class="TAGGER">blah</span>

and CSS

.TAGGER {	 margin:5px;	 font-family:Courier, serif;	 font-size:10px;	 color:#000;}

Link to comment
Share on other sites

That may be true, but if I add something like this:
TAGGER {	 margin:5px;	 font-family:Courier, serif;	 font-size:10px;	 color:#000;}

The browser would output it with a 5px margin, courier font face (serif) and a font-size of 10 pixels (#000 is usually the default for BODY tag. If not, TAGGER will inherit.)

I know, I understand how CSS works, the question is why you are using your own tag instead of an existing tag that will, at the very least, do the same thing and still remain valid. It looks like all you are doing is adding text that has a side-effect of causing the page to become invalid, so why not just do the same thing in a valid way? I just don't understand the point. Is it just for the novelty value of having your own tags? I don't get it. If it makes you feel good to use your own tags, then you will need to create your own DTD to define what that tag should do and use the DTD on all of your pages. Or, you can just use a span or a div.
Link to comment
Share on other sites

I could, but then it would have more bytes attached to the file. Using the TAGGER tag and using the CSS I provided causes the file(s) to have less space attached.<TAGGER> != <span class="tagger"> in terms of bytes.Same with.tagger != tagger in terms of bytes.

Link to comment
Share on other sites

You've got to be kidding, right?That difference is so small it would not be noticed even on dial up

.tagger != tagger in terms of bytes.
It is 1 byte more and you only write it once in your external css file plus that file gets cached anyway after the first load.
<tagger></tagger> vs <span class="tagger"></span>

this is only a difference of 19 bytes plus you could chane the class name to "tr" and reduce it to 15 bytes difference.15 bytes olny takes 0.004 seconds to download on an average (4Kb/sec) dial up connection. In other words the very small difference in file size will be unnoticable to users no matter their connection speed.

Link to comment
Share on other sites

what you describe would probably be bad for page rankings. Google likes well strucured documents. remember to a search engine tags are the only thing to describe the content i.e. <p> refering to a paragraph etc.

Link to comment
Share on other sites

what you describe would probably be bad for page rankings. Google likes well strucured documents. remember to a search engine tags are the only thing to describe the content i.e. <p> refering to a paragraph etc.
Page ranks shmage ranks. I've never had a Google PR before, even with valid code.
Link to comment
Share on other sites

that's funny cuz I got a PR3 ranking only after a couple of months on my blog (not the one in signature). I used valid xhtml strict, tableless code, and had new content every couple days. That is exactly what Google likes.

Link to comment
Share on other sites

It hasn't even been a month, let alone 3 months. Check out my site yourself and tell me my PR. Keep in mind, no custom tags are on my site (including my board.)

Link to comment
Share on other sites

Well if it hasn't been a month yet then don't worry, it takes a while. The more sites you can get to link to yours the better your rank gets too. I think your main problem is you have no content (real content). your main page is just a bunch of links that lead to text files. That won't get you ranked at all. So not surprising your rank is 0/10 (you can see the rank of any page with the Google toolbar.

Link to comment
Share on other sites

Exactly! I hate using the toolbar, because otherwise you'd have to go to the main google site to get a PR, and sometimes that's not even good enough. I don't know exactly why PRs are good anyway.

Link to comment
Share on other sites

PR is kinda like waiting in line. When some one searches for some keywords that relate to your site Google looks at your PR in determining where in the search results you will show up (along with some other stuff). You should head over to seochat.com and read some of their articles. It has some great advice on improving your visibility on search engines.

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×
×
  • Create New...