The SitePoint Forums have moved.

You can now find them here.
This forum is now closed to new posts, but you can browse existing content.
You can find out more information about the move and how to open a new account (if necessary) here.
If you get stuck you can get support by emailing forums@sitepoint.com

If this is your first visit, be sure to
check out the FAQ by clicking the
link above. You may have to register
before you can post: click the register link above to proceed. To start viewing messages,
select the forum that you want to visit from the selection below.

Basocally if you are using real XHTML then it is <hr/> and if you are not it is <hr>. The space before the slash just allows HTML to discard the invalid slash which may as well not be there in the first place.

Well formed (X)HTML is definitely far easier to maintain and saves loads of time that would be otherwise lost trying to trace errors caused by the browser deciding that the missing tag (that may be optional in HTML) belongs in a different spot to where you think it ought to be.

To me, a space before the NESTC+NET delimiters indicates someone who doesn't really know what he or she is doing. But that's just me.

LOL, Tommy, and I thought this topic made me grumpy. It may not be so much that someone doesn't know what they're doing, but trying to do "the right (or modern) thing" and code in XHTML, and ending up making fundamental compromises such as this thread addresses. You're right, it makes more sense to code in HTML 4.01 Strict and let XHTML hang until the community/industry gets it correlated, but a tremendous amount of "expert" sites push the assumption that only XHTML coding is up-to-date. I know I spent some time trying to teach myself XHTML before learning (in these forums) that I was better off sticking with HTML Strict.

Off Topic:

just tweakin' you, buddy. Mrs. Max says hi.

Off Topic:

And how come Eric Meyer's site is in HTML Transitional? Like I'm the one to point fingers at him....

Appendix C of the XHTML standard on making your XHTML compatible to be served as HTML actually specifies that the space is required in that situation. This is because the / is actually invalid when the page is served as HTML and the space is needed to stop it making the preceding attribute invalid as well. The space isn't needed when you are writing real XHTML for example <script type="text/javascript" src="myscript"/> (although adding the space wouldn't allow that XHTML to work as HTML either since in HTML it must have a separate closing tag for scripts).

And yeah, I know that you are using vBulletin, but the layout is custom so it could've been made using HTML instead of XHTML. Just saying...

FYI, I, personally, have nothing to do with SitePoint Pty Ltd or the forum software. I'm just a volunteer moderator, which is like any other member but with a few extra privileges.

Originally Posted by samanime

I wasn't aware that putting a space was actually not allowed.

It is allowed. It's just not necessary.

Originally Posted by Black Max

It may not be so much that someone doesn't know what they're doing

What I meant was that most people who use pretend-XHTML (XHTML markup served as HTML) don't understand the real difference between XHTML and HTML. As you say, they've been duped into believing that pretend-XHTML is somehow better (more strict, more semantic) than HTML, which is, of course, ********.

Originally Posted by Black Max

You're right, it makes more sense to code in HTML 4.01 Strict and let XHTML hang until the community/industry gets it correlated

In most cases it doesn't make much sense to serve X(HT)ML to clients at all, even if Microsoft should eventually decide to implement support for XHTML.

Originally Posted by Black Max

a tremendous amount of "expert" sites push the assumption that only XHTML coding is up-to-date.

Every source on the Internet should be regarded with a healthy amount of scepticism and distrust. (Yes, that includes my blog, too.) The Web lets anyone publish anything.

You'll have to ask him about that. My guess is that he uses a publishing tool that doesn't guarantee pure markup, but it's just a guess.

Originally Posted by felgall

Appendix C of the XHTML standard on making your XHTML compatible to be served as HTML actually specifies that the space is required in that situation.

Appendix C contains HTML compatibility guidelines; it's not a specification. The whole appendix is informative, not normative. So it can't state that something is required, only recommended.

Originally Posted by felgall

This is because the / is actually invalid when the page is served as HTML

No, it's not invalid. It just means something different than in XHTML. (Or, rather, it means the same thing, but uses a different syntax.) Virtually no HTML browser supports the SGML SHORTTAG feature which is declared for HTML (but not for X(HT)ML), so NETs are never used in honest HTML.

Originally Posted by felgall

the space is needed to stop it making the preceding attribute invalid as well.

It doesn't make any attribute invalid. The space is recommended in pretend-XHTML because of some particularly buggy HTML parsers in antique browsers.

It doesn't make any attribute invalid. The space is recommended in pretend-XHTML because of some particularly buggy HTML parsers in antique browsers.

That's basically the same thing as being invalid without the space. HTML parsers as you say don't accept the shorttag option and so wouldn't be expecting to see a / there. Netscape 4 (to name one of those "buggy" antique browsers) would then treat the slash as part of the preceding attribute (since without the space there is nothing to say that it isn't) and then that attribute would probably fail to work because of its ending with a slash.

@AutisticCuckoo: I'm aware you aren't employed by SitePoint. I just chose that particular page to show that this entire forum would be entirely unusable, and thus this discussion wouldn't even take place, if it weren't for the fact that it was incorrectly served as "pretend-XHTML", i.e. (malformed) XHTML served as text/html.