Hi there!
Good question. The reason why it may or may not work depending on the browser or what follows in the HTML will depend on the browser and their interpretation/implementation of the standards, commonly referred to as either "strict" or "quirks". There is a good site - http://www.quirksmode.org that can explain some of the nuances of the two different modes in the various popular browsers.
I have a return question...why use an "empty" <div> tag? This tag is supposed to be used as a container for other elements/items on the page. It looks from your code that you're using the <div> as a "block" to create space. You could achieve this with a 1px transparent .gif file contained in the <div> and that way it won't be affected by additional tags following the "empty" <div>.
I doubt you'll get reliable results trying to use the XHTML notation style in all the browsers, so you're probably going to end up changing back to a more "standard" style.
I hope this helps,
Ric
|
|
Expert:
|
rcastagna
|
|
Date:
|
Oct 09, 2006
|
|
Time:
|
21:21
|
|
|
|
Votes: Good (0) | Bad (0) Login to rate this answer
|
|
|
Yeah, good return question :-)
Basically, my question was - of course - just out of curiosity, not because it was a big problem for me.
However, it becomes something of a problem at times when your code is not working and you have to figure out why. Since I felt, I was using the right notation, it bothered me that browsers didn't agree.
|
|
Expert:
|
jgivoni
|
|
Date:
|
Oct 09, 2006
|
|
Time:
|
21:41
|
|
|
|
Votes: Good (0) | Bad (0) Login to rate this answer
|
|
|
But if I should answer your question with a more practical approach, I dare say that it is very handy to have empty div's - for instance to create blocks. Or to put something in them later (DHTML).
Another thing: Take the <script> tag in the <head> section:
<script type="text/javascript" src="javascript.js"/>
This would be the obvious way to do it - but it doesn't work either.
My problem is that I was used to doing so, when I used XSL. It worked fine.
|
|
Expert:
|
jgivoni
|
|
Date:
|
Oct 09, 2006
|
|
Time:
|
21:47
|
|
|
|
Votes: Good (0) | Bad (0) Login to rate this answer
|
|
|
I've noticed that, too...
It seems that the <link /> tag will accept the "short" XHTML convention, but <script> won't. There must be something with the tag specification/standards, that won't allow something that should be a container to be short-handed. Of course, the obvious counter to that argument would be the <p /> tag. Oh, well...sometimes I really wonder what on earth is really going on with the "standards" these days.
|
|
Expert:
|
rcastagna
|
|
Date:
|
Oct 09, 2006
|
|
Time:
|
22:16
|
|
|
|
Votes: Good (0) | Bad (0) Login to rate this answer
|
|
|
|
|
Expert:
|
jgivoni
|
|
Date:
|
Oct 09, 2006
|
|
Time:
|
23:45
|
|
|
|
Votes: Good (0) | Bad (0) Login to rate this answer
|
|
In the SGML declaration of HTML, minimisation (SHORTTAG) is turned on (set to YES), whereas in the SGML declaration of XHTML it is turned off (set to NO). As a result, in HTML, <div/> translates to <div></div>>. If you have <body><div/></body>, this translates to <body><div></div>></body> where the orphan closed chevron is contained directly by the body-tag. As the HTML specification also forbids the body-tag from directly containing data, this will not validate.
For further details, have a read of: http://www.cs.tut.fi/~jkorpela/html/empt...
Hope this was helpful,
Mark
|
|
|
|
|
|
|
This question has been answered, and points have been rewarded to the following experts:
| rcastagna: |
25 |
| jgivoni: |
25 |
You're welcome however to comment or give additional information or if you wish, you have the ability to write an Answer Summary for this question by clicking on the "Answer Summaries" Tab.
|
|