|
Posted by RvT on June 21, 2007, 9:30 pm
Please log in for more thread options
On 19 jun, 00:12, Summercooln...@gmail.com wrote:
> so i am starting to use more of <br /> and <div style="clear: both" />...
>
> which is the XHTML style...
>
> now, won't those actually confuse the old browsers? for example,
> will the old browser treat the "div" as not closing, and so everything
> after the div will be treated as part of that div?
<div /> does not exist as it is an container of information, just like
<p> and <b>, etc. <br/> does need the extra slash because it does not
contain information. So, it is:
<div>content</div>
<b>content</b>
<p>content</p>
but
Hello<br/>
next line
It is really not so difficult.
|
|
Posted by Jukka K. Korpela on June 22, 2007, 6:15 am
Please log in for more thread options
Scripsit RvT:
> <div /> does not exist as it is an container of information,
Of course it exists. In XHTML, it is a valid element, which is equivalent to
<div></div>. If it did not exist, there would be no reason to say that it
should not be used (in documents that might be processed by software that
does not understand XML), as the XHTML 1.0 specification says. There's no
point in saying "should not" about something to which "shall not" already
applies (such as invalid documents).
It's a container element, just with empty content. It's bad practice, though
not explicitly frowned upon in specifications. Oddly enough, the HTML 4.01
specification explicitly says that empty _paragraphs_ (<p></p>) should not
be used and that browsers should ignored them, but it has no such statement
about empty div (or about a paragraph with dummy content, such as the common
bogosity <p> </p>).
> It is really not so difficult.
People can make things difficult to themselves by using XHTML without
understanding it and even mixing XHTML and classic HTML.
--
Jukka K. Korpela ("Yucca")
http://www.cs.tut.fi/~jkorpela/
|
|
Posted by Ben C on June 22, 2007, 6:31 am
Please log in for more thread options
> Scripsit RvT:
>
>> <div /> does not exist as it is an container of information,
[...]
> It's a container element, just with empty content. It's bad practice, though
> not explicitly frowned upon in specifications. Oddly enough, the HTML 4.01
> specification explicitly says that empty _paragraphs_ (<p></p>) should not
> be used and that browsers should ignored them,
It does say that, but do any of them ignore them?
I don't know much about the history of these things, but it seems that
that may have partially evolved into the margin-collapsing rules in CSS
2.1, especially the rule that margins collapse "through" zero-height
boxes.
Assuming for the sake of argument that <p> is in no way special apart
from its default styles of display: block, top and bottom margins, and
no padding or borders, then according to the margin collapsing rules:
<p>Blah blah</p>
<p></p>
<p></p>
<p></p>
<p></p>
<p></p>
<p>Blah blah</p>
renders exactly the same as
<p>Blah blah</p>
<p></p>
<p>Blah blah</p>
since the margins of all those adjacent empty paragraphs collapse
through each other. Of course this isn't quite the same as "ignoring
empty paragraphs" but it renders the same in many circumstances.
|
|
Posted by Jukka K. Korpela on June 22, 2007, 6:52 am
Please log in for more thread options
Scripsit Ben C:
>> Oddly enough, the HTML 4.01 specification explicitly says that empty
>> _paragraphs_ (<p></p>) should not be used and that browsers should
>> ignored them,
>
> It does say that, but do any of them ignore them?
I haven't made any study on this, since I think it suffices to know the
recommendation, see that it is reasonable, and to know fairly surely that
some browsers fail to follow the recommendation. After all, as an author, I
don't care about the treatment of some constructs that I should not use and
do not use.
> according to the margin collapsing rules:
>
> <p>Blah blah</p>
> <p></p>
> <p></p>
> <p></p>
> <p></p>
> <p></p>
> <p>Blah blah</p>
>
> renders exactly the same as
>
> <p>Blah blah</p>
> <p></p>
> <p>Blah blah</p>
That's what happens on IE 7, and the rendering is exactly the same as for
<p>Blah blah</p>
<p>Blah blah</p>
The behavior is the same with CSS disabled, using the well-known "toggle
CSS" favelet, though I'm not sure how well it disables the "browser style
sheet".
And it's the same even in Quirks Mode.
--
Jukka K. Korpela ("Yucca")
http://www.cs.tut.fi/~jkorpela/
|
|
Posted by RvT on June 22, 2007, 11:00 am
Please log in for more thread options
> Scripsit RvT:
>
> > <div /> does not exist as it is an container of information,
>
> Of course it exists. In XHTML, it is a valid element, which is equivalent to
> <div></div>.
A DIV needs to be opened and close, there is not such thing as <div /
>, that would result in a validation error.
|
| Similar Threads | Posted | | Re: DTD in browsers | May 3, 2006, 4:24 pm |
| Re: DTD in browsers | May 4, 2006, 3:30 am |
| " last word 3 browsers | July 8, 2005, 7:51 am |
| What browsers are using to test? | February 20, 2006, 9:50 am |
| Dynamic Menu for all browsers | October 7, 2004, 2:10 pm |
| Different browsers render differently | October 26, 2004, 4:50 pm |
| Controlling web browsers with META | January 22, 2005, 12:43 am |
| XHTML authoring and browsers | November 26, 2005, 1:48 pm |
| Inconsistent Display in Different Browsers | December 7, 2005, 7:06 pm |
| Help! new site is crashing IE browsers! | November 17, 2006, 10:38 pm |
|