Re: [CSS21] Default table border width in collapsing border model

Le Mer 4 janvier 2012 12:15, Christian Roth a écrit :
> Hello,
>
> thanks for the answers on my question. I am beginning to see how this is
> all meant, though I am still having a hard time to deduce this from what's
> actually written and drawn in the accompanying images in the spec.


Christian,

Accompanying images in the spec. are not perfectly and always reliable.
Example given:

[CSS21] WD 07 Dec. 2010: errors in section 17.6.1 Separated borders model
and width of table
http://lists.w3.org/Archives/Public/www-style/2011Feb/0652.html

and I have a few other examples like that.

One significant flaw of CSS2.1 is that each and all of the examples (and
code examples) given in the spec has no demo pages, no live test to be
found anywhere. I have done a lot of such work when I could not figure out
what the spec or example was talking about and found many inconsistencies
(sometimes important ones) between the diagram and the code.

>
> What I failed to realize is that the table box is considered to have a
> virtual border (which is never explicitly specified in a stylesheet),


Initial border-style for elements is 'none'

'border-top-style', 'border-right-style', 'border-bottom-style',
'border-left-style'
    Value:  	<border-style> | inherit
    Initial:  	none
    Applies to:  	all elements
http://www.w3.org/TR/CSS21/box.html#border-style-properties


> whose color is transparent,

Initial border-color for elements is 'color'

'border-top-color', 'border-right-color', 'border-bottom-color',
'border-left-color'
    Value:  	<color> | transparent | inherit
    Initial:  	the value of the 'color' property
    Applies to:  	all elements

http://www.w3.org/TR/CSS21/box.html#border-color-properties

> and whose widths for the four sides (in the
> spec called - misleadingly, because the overlapping of the term "initial"
> with "initial value" of properties - "initial table border widths") are
> calculated by the algorithm given in 17.6.2.

I'm not sure you are correct here :)

When your CSS code starts with:

            table
            {
                border: solid red;
                border-collapse: collapse;
            }

            td
            {
                background: transparent;
                border: 50px solid blue;
                padding: 10px;
                width: 100px;
            }
            td#c2
            {
                border-left: none;
            }

then this can be translated into (with all the initial values but still
with shorthand form)

            table
            {
                border-top: red solid medium;
                border-right: red solid medium;
                border-bottom: red solid medium;
                border-left: red solid medium;
                border-collapse: collapse;
            }

            td
            {
                background: transparent;
                border-top: blue solid 50px;
                border-right: blue solid 50px;
                border-bottom: blue solid 50px;
                border-left: blue solid 50px;
                padding: 10px;
                width: 100px;
            }
            td#c2
            {
                border-left: black none medium;
            }

Right here, there are 2 border-left declarations applying for the same #c2
cell:
border-left: blue solid 50px;
and
border-left: black none medium;
and only the more specific selector will apply.

border-left: black none medium; will "win" and medium will be resolved as
0px because "Computed value:  	absolute length; '0' if the border style is
'none' or 'hidden' "

This is the step, I think, you missed. And this all occurs before entering
the border conflict resolution mechanisms.

Gérard
-- 
CSS 2.1 Test suite RC6, March 23rd 2011
http://test.csswg.org/suites/css2.1/20110323/html4/toc.html

Contributions to CSS 2.1 test suite
http://www.gtalbot.org/BrowserBugsSection/css21testsuite/

Web authors' contributions to CSS 2.1 test suite
http://www.gtalbot.org/BrowserBugsSection/css21testsuite/web-authors-contributions-css21-testsuite.html

Received on Wednesday, 4 January 2012 20:54:40 UTC