View Full Version : Span <> Div
angiras
01-09-2003, 02:59 PM
what is the difference between a div and a span, except the display block for div and display inline for span ?
thank you
Mhtml
01-09-2003, 03:21 PM
Well apart from that none.
angiras
01-09-2003, 03:39 PM
thank you
Catman
01-09-2003, 05:38 PM
Well, there's one more. In strict XHTML 1.0, you can nest divs but you can't nest spans.
angiras
01-09-2003, 06:38 PM
I don't really understand the meaning of nesting !
Catman
01-09-2003, 07:10 PM
Nesting:
<div>
This is the outer div.
<div>
This is the first inner div.
</div>
<div>
This is the second inner div.
<div>
This is a third level div.
</div>
</div>
</div>
angiras
01-09-2003, 07:23 PM
I have tried
<?xml version="1.0" encoding="iso-8859-1"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 strict//EN" "DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="fr">
<head>
</head>
<body id="body">
<span>
This is the outer span.
<span>
This is the first inner span.
</span>
<span>
This is the second inner span.
<span>
This is a third level span.
</span>
</span>
</span>
</body>
</html>
and the same with div
both are working
Catman
01-09-2003, 07:50 PM
There's a difference between "working" and "valid" -- nesting spans will work just fine on most current browsers, but it's not valid XHTML.
angiras
01-09-2003, 08:09 PM
with span I get
Line 8, column 5: document type does not allow element "span" here; missing one of "p", "h1", "h2", "h3", "h4", "h5", "h6", "div", "pre", "address", "fieldset", "ins", "del" start-tag
<span>
^
and with div it works
perfect ! I stop using span
thank you
vBulletin® v3.8.2, Copyright ©2000-2012, Jelsoft Enterprises Ltd.