summaryrefslogtreecommitdiffstats
path: root/testing/web-platform/tests/css/CSS2/positioning/absolute-non-replaced-height-006.xht
blob: 9992d47115720a352761e648ff32db400b5092d1 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
<!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">
    <head>
        <title>CSS Test: Absolutely positioned, non-replaced elements, over-constrained</title>
        <link rel="author" title="Microsoft" href="http://www.microsoft.com/" />
        <link rel="reviewer" title="Gérard Talbot" href="http://www.gtalbot.org/BrowserBugsSection/css21testsuite/" /> <!-- 2012-08-27 -->
        <link rel="help" href="http://www.w3.org/TR/CSS21/visudet.html#abs-non-replaced-height" />
		<link rel="match" href="absolute-non-replaced-height-006-ref.xht" />

        <meta name="assert" content="The 'bottom' value is ignored and the equation solves for the bottom value, when the values for 'top', 'bottom', 'height', 'margin-top', 'margin-bottom' add up to more than the containing blocks height." />
        <style type="text/css">
            #div1
            {
                border: 10px solid black;
                height: 300px;
                position: relative;
                width: 300px;
                overflow: auto;
            }
            div div
            {
                background: blue;
                height: 150px;
                margin-bottom: 50px;
                margin-top: 50px;
                position: absolute;
                top: 50px;
                width: 50%;
            }
            #div2
            {
                bottom: 50px;
            }

		/*

		50px : top
	+
		50px : margin-top
	+
		0 : border-top-width
	+
		0 : padding-top
	+
		150px : height
	+
		0 : padding-bottom
	+
		0 : border-bottom-width
	+
		50px : margin-bottom
	+
		50px : bottom
	=============
		350px  while the height of containing block is only 300px.

		So, here we definitely have an overconstrained situation. In which
		case the spec clearly states
		"If the values are over-constrained, ignore the value for 'bottom'
		and solve for that value."
		http://www.w3.org/TR/CSS21/visudet.html#abs-non-replaced-height

		So, here, the used value for bottom will be 0px so that the equation
		gets balanced.

		*/

            #div3
            {
                bottom: 0;
                left: 50%;
            }
        </style>
    </head>
    <body>
        <p>Test passes if there is one and only one blue rectangle inside an hollow black square and if such black square does not have a vertical scrollbar.</p>
        <div id="div1">
            <div id="div2"></div>
            <div id="div3"></div>
        </div>
    </body>
</html>