Source code

Revision control

Copy as Markdown

Other Tools

Test Info:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<head>
<title>CSS Writing Modes Test: non-replaced block in normal flow with 'direction: ltr' in vertical-lr (overconstrained)</title>
<link rel="author" title="Gérard Talbot" href="http://www.gtalbot.org/BrowserBugsSection/css21testsuite/" />
<link rel="help" href="http://www.w3.org/TR/css-writing-modes-3/#logical-direction-layout" title="7.4 Flow-Relative Mappings" />
<link rel="match" href="abs-pos-non-replaced-vlr-007-ref.xht" />
<meta name="flags" content="ahem image" />
<meta name="assert" content="This test checks that when an inline dimension of a non-replaced block in normal flow is over-constrained, the inline-end margin is dropped and recalculated so that the equation involving inline-size is balanced; such equation takes under account the inline's direction (ltr or rtl). In this test, the inline-end margin (physical margin-bottom) is recalculated." />
<!--
"
the margin that is dropped when a box’s inline dimension is over-constrained is the end margin as determined by the writing mode of the containing block.
"
7.4 Flow-Relative Mappings
"
'margin-left' + 'border-left-width' + 'padding-left' + 'width' + 'padding-right' + 'border-right-width' + 'margin-right' = width of containing block
If all of the above have a computed value other than 'auto', the values are said to be "over-constrained" and one of the used values will have to be different from its computed value. If the 'direction' property of the containing block has the value 'ltr', the specified value of 'margin-right' is ignored and the value is calculated so as to make the equality true. If the value of 'direction' is 'rtl', this happens to 'margin-left' instead.
"
CSS 2.1, section 10.3.3 Block-level, non-replaced elements in normal flow
-->
<meta name="DC.date.created" content="2015-10-16T09:54:03+11:00" scheme="W3CDTF" />
<meta name="DC.date.modified" content="2017-02-18T09:54:03+11:00" scheme="W3CDTF" />
<style type="text/css"><![CDATA[
html
{
writing-mode: vertical-lr;
}
body#containing-block
{
background-image: url("support/bg-red-3col-3row-320x320.png");
background-position: 198px 8px;
/* first value represents the horizontal position and the second represents the vertical position */
/*
16px (p's margin-left)
+
246px (img's width)
+
16px (p's margin-right)
========
278px
-
80px (1 column of 80px)
========
198px
*/
background-repeat: no-repeat;
direction: ltr;
height: 320px;
margin: 8px;
}
p
{
margin-left: 16px;
margin-right: 16px;
}
div
{
background-color: green;
margin-top: 160px;
border-top: green solid 20px;
padding-top: 20px;
height: 0px;
padding-bottom: 20px;
border-bottom: green solid 20px;
margin-bottom: -160px;
margin-left: 96px; /* 80px + 16px necessary so that we can reuse an already created and available reference file */
width: 80px;
}
/*
"
Layout calculation rules (such as those in CSS2.1, Section 10.3) that apply to the horizontal dimension in horizontal writing modes instead apply to the vertical dimension in vertical writing modes.
"
7.1 Principles of Layout in Vertical Writing Modes
So here, *-top and *-bottom properties are input into the §10.3.3 algorithms where *-top properties refer to *-left properties in the layout rules and where *-bottom properties refer to *-right properties in the layout rules.
'margin-top' + 'border-top-width' + 'padding-top' + 'height' + 'padding-bottom' + 'border-bottom-width' + 'margin-bottom' = height of containing block
So:
160px : margin-top
+
20px : border-top-width
+
20px : padding-top
+
0px : height
+
20px : padding-bottom
+
20px : border-bottom-width
+
-160px : margin-bottom
========================
80px : while the height of containing block of div is 320px
So, here, the specified value of 'margin-bottom' is ignored and the value is calculated so as to make the equality true
160px : margin-top
+
20px : border-top-width
+
20px : padding-top
+
0px : height
+
20px : padding-bottom
+
20px : border-bottom-width
+
(solve) : margin-bottom
========================
320px : height of containing block
And so computed margin-bottom value must be 80px .
*/
]]></style>
</head>
<body id="containing-block">
<p><img src="support/pass-cdts-abs-pos-non-replaced.png" width="246" height="36" alt="Image download support must be enabled" /></p>
<!--
The image says:
Test passes if there is a filled
green square and <strong>no red</strong>.
-->
<div></div>
</body>
</html>