473,382 Members | 1,380 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,382 software developers and data experts.

prinicpal block boxes (css 2.1)

Hi,

I'm a bit confused about the definition about "Prinicpal Block Boxes"
in CSS 2.1 draft specification.
( http://www.w3.org/TR/2006/WD-CSS21-20061106 )
>From the spec:
<pre>
9.2.1 Block-level elements and block boxes
The principal block box establishes the containing block for descendant
boxes and generated
content and is also the box involved in any positioning scheme
</pre>

The part "is also the box invovled in any positionnig scheme" seems to
contradict the definition of containing block, unless they mean that it
is indirectly involved?

<pre>
10.1 Definition of "containing block"
(Point 4)
If the element has 'position: absolute', the containing block is
established by the nearest ancestor with a 'position' of 'absolute',
'relative' or 'fixed', in the following way:
In the case that the ancestor is inline-level, the containing block
depends on the 'direction' property of the ancestor:
If the 'direction' is 'ltr', the top and left of the containing block
are the top and left padding edges of the first box generated by the
ancestor, and the bottom and right are the bottom and right padding
edges of the last box of the ancestor.
</pre>

So in the case the ancestor is inline, the containing block is
determined by the boxes it generates, and not directly from a prinicpal
block box

Any help appreciated in clearing this up .. .I'm sure I'm missing
something

Jan 25 '07 #1
6 2003
On 2007-01-25, da******@hotmail.com <da******@hotmail.comwrote:
Hi,

I'm a bit confused about the definition about "Prinicpal Block Boxes"
in CSS 2.1 draft specification.
( http://www.w3.org/TR/2006/WD-CSS21-20061106 )
>>From the spec:
<pre>
9.2.1 Block-level elements and block boxes
The principal block box establishes the containing block for descendant
boxes and generated
content and is also the box involved in any positioning scheme
</pre>

The part "is also the box invovled in any positionnig scheme" seems to
contradict the definition of containing block, unless they mean that it
is indirectly involved?
I don't understand where there's a contradiction here.

I assume by "the box involved in any positioning scheme" they mean the
box whose position is adjusted by the top, left, bottom and right
properties if it's position: fixed, relative or absolute.

But an absolutely positioned box also establishes a containing block for
its own descendents.
><pre>
10.1 Definition of "containing block"
(Point 4)
If the element has 'position: absolute', the containing block is
established by the nearest ancestor with a 'position' of 'absolute',
'relative' or 'fixed', in the following way:
In the case that the ancestor is inline-level, the containing block
depends on the 'direction' property of the ancestor:
If the 'direction' is 'ltr', the top and left of the containing block
are the top and left padding edges of the first box generated by the
ancestor, and the bottom and right are the bottom and right padding
edges of the last box of the ancestor.
</pre>

So in the case the ancestor is inline, the containing block is
determined by the boxes it [the ancestor] generates, and not directly
from a prinicpal block box
Yes, I've added [the ancestor] to what you wrote to be sure of no
ambiguity.

You're right that this appears to contradict 9.2.1, although I suppose
that said that all block boxes were containing blocks for their
descendents, not that all containing blocks were block boxes. It should
have said "in-flow descendents" or something like that.

Note that the only way a containing block can ever be inline is if it is
position:relative.
Any help appreciated in clearing this up .. .I'm sure I'm missing
something
Inline boxes as containing blocks is a bit of a strange idea, and I
don't think any of the browsers I tried get it competely right (Opera,
Konqueror and Firefox) Try this example:

http://www.tidraso.co.uk/misc/inline-cb.html

The consequence of 10.1 as written (and acknowledged) is that you can
get a negative width for the containing block. I can't see how that
could ever be useful.
Jan 25 '07 #2
Ben C wrote:
>
http://www.tidraso.co.uk/misc/inline-cb.html
You cannot have a Block (div) inside an Inline (span).

<http://validator.w3.org/check?verbose=1&uri=http%3A%2F%2Fwww.tidraso.co.uk %2Fmisc%2Finline-cb.html>

--
Gus
Jan 25 '07 #3
On 2007-01-25, Gus Richter <gu********@netscape.netwrote:
Ben C wrote:
>>
http://www.tidraso.co.uk/misc/inline-cb.html

You cannot have a Block (div) inside an Inline (span).
Yes of course, but you can just make it another span and display:block--
the point is to illustrate how relatively positioned inline boxes form
containing blocks for positioned descendents.

In fact you don't even need to make it display:block since it's
position:absolute anyway.

I shall go and update the page now.
Jan 25 '07 #4
Hello,
So in the case the ancestor is inline, the containing block is
determined by the boxes it [the ancestor] generates, and not directly
from a prinicpal block box
= = = Citates
9.2.1
Block-level elements ... generate a principal block box

10.1 Definition of "containing block"
4.1. In the case that the ancestor is inline-level ...
4.2. Otherwise, the containing block is formed by the padding edge [p.
100] of
the ancestor.
= = = =

So in the case the ancestor is inline, the containing block is
determined by the boxes it [the ancestor] generates. Principal blcok
box is not applicable in this context (not generated by inline-level
elements). While for block-level elements (4.2) I guess principal block
box assumed.

>Inline boxes as containing blocks is a bit of a strange idea
... you can get a negative width for the containing block.
Yes, negative width is confusing. But even in this case it can be
usefull. In example below 'right' abolutely positioned div sticked to
'left' one.

= = = = =
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
"http://www.w3.org/TR/REC-html40/strict.dtd">
<html>
<head>
<title>Inline containing blocks</title>
<style type="text/css">
.left {
display:inline;
}

.glue {
display:inline;
position:relative;
}

.right {
position:absolute;
left: 0px;
top: 0px;
width: 40px;
height: 40px;
border: 1px dashed gray;
}
</style>
</head>
<body>
<div class="left">
left left left left left left left left left left left
left left left left left left left left left left left
left left left left left left left left left left left
</div>
<div class="glue">
<div class="right">right</div>
</div>
</body>
</html>
= = = = =
But I myself confused by the 9.2.1. words:
Block-level elements (...) generate a principal block box that contains
either only block boxes or
only inline boxes.

What is about a situation when element contains both: block boxes and
inline boxes?
Regards,
- Alex

Jan 26 '07 #5
On 2007-01-26, fo***********@gmail.com <fo***********@gmail.comwrote:
Hello,
>So in the case the ancestor is inline, the containing block is
determined by the boxes it [the ancestor] generates, and not directly
from a prinicpal block box

= = = Citates
9.2.1
Block-level elements ... generate a principal block box

10.1 Definition of "containing block"
4.1. In the case that the ancestor is inline-level ...
4.2. Otherwise, the containing block is formed by the padding edge [p.
100] of
the ancestor.
= = = =

So in the case the ancestor is inline, the containing block is
determined by the boxes it [the ancestor] generates. Principal blcok
box is not applicable in this context (not generated by inline-level
elements). While for block-level elements (4.2) I guess principal block
box assumed.
Yes.
>>Inline boxes as containing blocks is a bit of a strange idea
... you can get a negative width for the containing block.

Yes, negative width is confusing. But even in this case it can be
usefull. In example below 'right' abolutely positioned div sticked to
'left' one.
There's no negative width there though, you've set the width of .right
to 40px.

The fact that the top left of the containing block for .right is given
by the top left of the first inline box of .glue is useful. It's
anchoring the bottom right to the bottom right of the last inline box of
..glue that can result in a negative width, and which no browser I've
found actually does.

[snip]
But I myself confused by the 9.2.1. words:
Block-level elements (...) generate a principal block box that contains
either only block boxes or
only inline boxes.

What is about a situation when element contains both: block boxes and
inline boxes?
Anonymous block boxes are created as necessary to enclose the inline
boxes. See CSS 2.1 9.2.1.1.
Jan 26 '07 #6
Hi,
The fact that the top left of the containing block for .right is given
by the top left of the first inline box of .glue is useful. It's
anchoring the bottom right to the bottom right of the last inline box of
.glue that can result in a negative width, and which no browser I've
found actually does.
I just wanted to say, that .glue box (if always kept empty), provide
the means to stick .right div to .left. May be in some design this can
be usefull.
Anonymous block boxes are created as necessary to enclose the inline
boxes. See CSS 2.1 9.2.1.1.
I see, thank you.

- Alex.

Jan 26 '07 #7

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

7
by: James Thornton | last post by:
I'm trying to make the transition from tables to CSS, and I need someone to explain how to achieve the following layout (understanding the concepts behind this layout will help me considerably in...
7
by: Jeff Thies | last post by:
I'm trying to do a nav list using list items. Roughly this is putting links styled display: block and with a background color. In IE5 (windows, haven't tried Mac yet), adding the display:...
7
by: Zhang Weiwu | last post by:
Hello. This is problem puzzled me a long time. I wish to organize some block elements and let them flow one after each other like text. Think about a album, I wish the album have 12 thumbnails,...
12
by: news | last post by:
I'm having a heck of a time, and I'm hoping someone can take a quick look and see if they can recognize what might be the problem and point me the right direction. My blog page:...
2
by: saxm-un | last post by:
Hi, I'm just beginning CSS based web development and although I've been bashing away at it since yesterday, I'm still stuck with positioning things on pages. I'm trying to make (in table-speak)...
4
by: kent | last post by:
Hi, If a block box appears in an inline formating context, it will start a new line box. However, I can't find where this is stated in the CSS spec. Any pointer? Thanks!
10
by: Itaichuk | last post by:
Hi I read in several CSS tutorials that block-level elements, such as <div& <pare rendered with an implicit line break before and after. I set to test this out using the following HTML: I...
4
by: Adam | last post by:
Hi all, I've got a tricky CSS problem that I could use some help with. What I'm trying to do is to set up a column-based layout, with each column holding a number of <divblocks. These div blocks...
5
by: dangt85 | last post by:
Hello, I have the following page: ... <style type="text/css"> body { font-family: Verdana, Arial, Helvetica, sans-serif; font-size: 12px; }
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.