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

Is my explanation right?

P: n/a
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd ">
<html xmlns="http://www.w3.org/1999/xhtml">
<body>
<a href="">a href</a>
<a>
<button style="display:block;">a button</button>
</a>
</body>
</html>
According to the rending result, I tried to explain: block-level
element <buttongenerates a block box, and according to the containing
block's definition in css2.1 spec, it's containing block should be the
block box generated for <bodyelement; Because a containing block can
only contain either block boxes or inline boxes, two anonymous block
box should be generated, each wrapping a inline box generated for <a>
elements, so the button box's containing block should be the anonymous
block box, right? and what is the second <a>'s inline box? Does it
contain the button's block box?
TIA.

Nov 5 '06 #1
Share this Question
Share on Google+
4 Replies


P: n/a
On 2006-11-05, ha******@gmail.com <ha******@gmail.comwrote:
><?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd ">
<html xmlns="http://www.w3.org/1999/xhtml">
<body>
<a href="">a href</a>
<a>
<button style="display:block;">a button</button>
</a>
</body>
</html>
According to the rending result, I tried to explain: block-level
element <buttongenerates a block box, and according to the containing
block's definition in css2.1 spec, it's containing block should be the
block box generated for <bodyelement;
Yes.
Because a containing block can only contain either block boxes or
inline boxes,
Yes, if you mean "either all block or all inline but not a mixture of
the two".
two anonymous block box should be generated, each wrapping a inline
box generated for <aelements, so the button box's containing block
should be the anonymous block box, right?
I think its containing block should still be body (see below). But it
seems Firefox disagrees, because if you set a height on body and a
percentage height on the button, it fails to resolve the percentage.
and what is the second <a>'s inline box? Does it contain the button's
block box?
Its inline box is broken into two (inline boxes often do that, whenever
lines are broken). The first inline box contains any text in the <a>
before the button starts (nothing in your example). The second inline
box contains any text after the button.

My understanding is that this is what you should get, where I've
inserted "anonblock" elements and [inline boxes] for the second <a>.

<body>

<anonblock>
<a href="">a href</a>
<a>[inline box 1]
</anonblock>

<button style="display:block;">a button</button>

<anonblock>
[inline box 2]</a>
</anonblock>

</body>

Body contains only block boxes, three of them.

The first anonblock contains only inline boxes, two of them, the first
<aand the first bit of the second <a(which in this example is
empty).

The second block is the button which contains one inline box for "a
button".

The third anonymous block contains only one inline box, the rest of the
first <a>, which is also empty.
Nov 5 '06 #2

P: n/a
Great! It's very helpful!
Ben C 写道:
On 2006-11-05, ha******@gmail.com <ha******@gmail.comwrote:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd ">
<html xmlns="http://www.w3.org/1999/xhtml">
<body>
<a href="">a href</a>
<a>
<button style="display:block;">a button</button>
</a>
</body>
</html>
According to the rending result, I tried to explain: block-level
element <buttongenerates a block box, and according to the containing
block's definition in css2.1 spec, it's containing block should be the
block box generated for <bodyelement;

Yes.
Because a containing block can only contain either block boxes or
inline boxes,

Yes, if you mean "either all block or all inline but not a mixture of
the two".
two anonymous block box should be generated, each wrapping a inline
box generated for <aelements, so the button box's containing block
should be the anonymous block box, right?

I think its containing block should still be body (see below). But it
seems Firefox disagrees, because if you set a height on body and a
percentage height on the button, it fails to resolve the percentage.
and what is the second <a>'s inline box? Does it contain the button's
block box?

Its inline box is broken into two (inline boxes often do that, whenever
lines are broken). The first inline box contains any text in the <a>
before the button starts (nothing in your example). The second inline
box contains any text after the button.

My understanding is that this is what you should get, where I've
inserted "anonblock" elements and [inline boxes] for the second <a>.

<body>

<anonblock>
<a href="">a href</a>
<a>[inline box 1]
</anonblock>

<button style="display:block;">a button</button>

<anonblock>
[inline box 2]</a>
</anonblock>

</body>

Body contains only block boxes, three of them.

The first anonblock contains only inline boxes, two of them, the first
<aand the first bit of the second <a(which in this example is
empty).

The second block is the button which contains one inline box for "a
button".

The third anonymous block contains only one inline box, the rest of the
first <a>, which is also empty.
Nov 5 '06 #3

P: n/a
ha******@gmail.com wrote:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd ">
<html xmlns="http://www.w3.org/1999/xhtml">
<body>
<a href="">a href</a>
<a>
<button style="display:block;">a button</button>
</a>
</body>
</html>
According to the rending result, I tried to explain: block-level
element <buttongenerates a block box, and according to the containing
block's definition in css2.1 spec, it's containing block should be the
block box generated for <bodyelement; Because a containing block can
only contain either block boxes or inline boxes, two anonymous block
box should be generated, each wrapping a inline box generated for <a>
elements, so the button box's containing block should be the anonymous
block box, right? and what is the second <a>'s inline box? Does it
contain the button's block box?
Your code is invalid, so, as is, there's no point trying to analyze the
"correct" handling of it. First, you're missing a HEAD tag, which has to
have a TITLE tag inside. Second, in Strict mode inline elements aren't
allowed directly inside the body.

Nov 6 '06 #4

P: n/a
I modified the code, and now it passed the w3c's validation. Thanks.

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<meta http-equiv="Content-Type"
content="text/html;charset=utf-8"></meta>
<title></title>
</head>

<body>
<p>
<a href="ahref">a href</a>
<a>
<button style="display:block;">a button</button>
</a>
</p>
</body>
</html>

"Harlan Messinger д
"
ha******@gmail.com wrote:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd ">
<html xmlns="http://www.w3.org/1999/xhtml">
<body>
<a href="">a href</a>
<a>
<button style="display:block;">a button</button>
</a>
</body>
</html>
According to the rending result, I tried to explain: block-level
element <buttongenerates a block box, and according to the containing
block's definition in css2.1 spec, it's containing block should be the
block box generated for <bodyelement; Because a containing block can
only contain either block boxes or inline boxes, two anonymous block
box should be generated, each wrapping a inline box generated for <a>
elements, so the button box's containing block should be the anonymous
block box, right? and what is the second <a>'s inline box? Does it
contain the button's block box?

Your code is invalid, so, as is, there's no point trying to analyze the
"correct" handling of it. First, you're missing a HEAD tag, which has to
have a TITLE tag inside. Second, in Strict mode inline elements aren't
allowed directly inside the body.
Nov 7 '06 #5

This discussion thread is closed

Replies have been disabled for this discussion.