By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
464,345 Members | 1,207 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 464,345 IT Pros & Developers. It's quick & easy.

<br /> or <div /> with old browsers...

P: n/a
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?

Jun 19 '07 #1
Share this Question
Share on Google+
10 Replies

P: n/a
Scripsit Su************@gmail.com:
so i am starting to use more of <br /and <div style="clear: both" /
>...
which is the XHTML style...
Are trolling, or just clueless? You posted the same question to
c.i.w.a.stylesheets, with a different Subject and different wording, but
exhibiting the same ignorance-based willingness to use XHTML. You apparently
haven't read this group even for a few days; otherwise you wouldn't think
about using XHTML style.

Please learn to post to Usenet before starting to compose your next message:
http://www.cs.tut.fi/~jkorpela/usenet/dont.html

--
Jukka K. Korpela ("Yucca")
http://www.cs.tut.fi/~jkorpela/

Jun 19 '07 #2

P: n/a
<Su************@gmail.composted...
: so i am starting to use more of <br /and <div style="clear:both"/>...
: which is the XHTML style...

<div style="clear:both;margin:0px auto;width:200px;border:1px solid #0000CC;text-align:center;line-height:1.5em;padding:0.2em;">Some
Content</div>

As far as I know <divalways has a closing tag. I've NEVER
seen <div/until your post here. Even HTML requires a closing
tag.

Also note that <divtags may default to clear:both; so that may
not be needed. Most browsers insert a line-break before the
starting <divand after the completing </divtags.

http://www.w3schools.com/tags/
http://www.w3schools.com/tags/tag_div.asp

--
Jim Carlock
Jun 19 '07 #3

P: n/a
On Jun 19, 7:26 am, "Jim Carlock" <anonym...@127.0.0.1wrote:
As far as I know <divalways has a closing tag. I've NEVER
seen <div/until your post here.
It is fine in (true) XHTML (for which the previously mentioned 'older
browsers' will go 'Eh? Don't recognise this. You wanna save it to your
disk?'
Even HTML requires a closing
tag.
The above code sample has a closing tag.
Also note that <divtags
Elements, not tags
may default to clear:both;
They don't
http://www.w3schools.com/tags/http:/...gs/tag_div.asp
Avoid w3schools. They provide more errors per paragraph then any other
HTML tutorial site.
--
David Dorward
http://dorward.me.uk/
http://blog.dorward.me.uk/

Jun 19 '07 #4

P: n/a
On 19 Jun, 06: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?
Who knows? Who can know how many obscure old browsers your code might
meet on its travels.

So go read the XHTML Appendix C notes on HTML compatibility. They'll
tell you.

Jun 19 '07 #5

P: n/a
RvT
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
<pand <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.

Jun 22 '07 #6

P: n/a
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>&nbsp;</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/

Jun 22 '07 #7

P: n/a
On 2007-06-22, Jukka K. Korpela <jk******@cs.tut.fiwrote:
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 <pis 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.
Jun 22 '07 #8

P: n/a
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/

Jun 22 '07 #9

P: n/a
RvT
On 22 jun, 05:15, "Jukka K. Korpela" <jkorp...@cs.tut.fiwrote:
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.
Jun 22 '07 #10

P: n/a
On Jun 22, 4:00 pm, RvT <rmvan...@gmail.comwrote:
On 22 jun, 05:15, "Jukka K. Korpela" <jkorp...@cs.tut.fiwrote:
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 />,
<div /is opening and closing the div element.
that would result in a validation error.
Try it in a validator and see.

Steve

Jun 22 '07 #11

This discussion thread is closed

Replies have been disabled for this discussion.