Le 9 avr. 2014 à 15:48, Karl DeSaulniers <k...@designdrumm.com> a écrit :

> Looks like there are some exceptions. Have a look see...
> There ARE a few that took on the browser width, but the majority stuck with 
> their parent. 
> 
> http://designdrumm.com/percentage_test.html

1. An element that is position: absolute with a percentage width takes its 
width from its nearest _positioned_ parent [ex1] else from the root element 
[ex2]

see:
http://www.w3.org/TR/CSS21/visudet.html#propdef-width
http://www.w3.org/TR/CSS21/visudet.html#abs-non-replaced-width

[ex1] <div style="position: relative; width: 10em">
        <p style="position: absolute" width: 50%; > // computed value for 
width: 5em
[ex2] <body>
        <div style="width: 10em">
        <p style="position: absolute" width: 50%; > // computed value for 
width: half the width of the browser window

For ultimate fun in this:
[ex3] <div style="position: absolute;"> // no width specified, shrink-to-fit
        <p style="position: absolute" width: 50%; > // computed value for 
width: ****undefined****

2. An element that has position:absolute and float: left (or right) will have 
as computed value: float: none;
see http://www.w3.org/TR/CSS21/visuren.html#dis-pos-flo (bullet point 2)



Philippe
--
Philippe Wittenbergh
http://l-c-n.com




______________________________________________________________________
css-discuss [css-d@lists.css-discuss.org]
http://www.css-discuss.org/mailman/listinfo/css-d
List wiki/FAQ -- http://css-discuss.incutio.com/
List policies -- http://css-discuss.org/policies.html
Supported by evolt.org -- http://www.evolt.org/help_support_evolt/

Reply via email to