blob: aa671b2757a3728775d9e2b01fbc7c781eb0e8b3 [file] [log] [blame]
<!DOCTYPE html>
<!--
| If none of the three is "auto": if both "margin-left" and "margin-right" are
| "auto", solve the equation under the extra constraint that the two margins
| get equal values, unless this would make them negative, in which case set
| "margin-left" to zero and solve for "margin-right". If one of "margin-left"
| or "margin-right" is "auto", solve the equation for that value. If the values
| are over-constrained, ignore the value for "right" and solve for that value.
| https://www.w3.org/TR/CSS21/visudet.html#abs-non-replaced-width
-->
<html>
<head>
<style>
.first {
top: 10px;
}
.second {
top: 45px;
}
.third {
top: 80px;
}
.fourth {
top: 115px;
}
.fifth {
top: 150px;
}
.containing-block {
background-color: #2196f3;
height: 5px;
padding: 10px 0;
position: absolute;
width: 500px;
}
.block {
/* TODO: Add borders when supported. */
background-color: #3f51b5;
display: block;
height: 5px;
left: 50px;
padding: 0 100px;
position: absolute;
right: 50px;
width: 150px;
}
.wide {
width: 300px;
}
.auto-margin-left {
margin-left: auto;
}
.non-auto-margin-left {
margin-left: 50px;
}
.auto-margin-right {
margin-right: auto;
}
.non-auto-margin-right {
margin-right: 50px;
}
</style>
</head>
<body>
<div class="first containing-block">
<div class="auto-margin-left auto-margin-right block"></div>
</div>
<div class="second containing-block">
<div class="auto-margin-left auto-margin-right wide block"></div>
</div>
<div class="third containing-block">
<div class="auto-margin-left non-auto-margin-right block"></div>
</div>
<div class="fourth containing-block">
<div class="non-auto-margin-left auto-margin-right block"></div>
</div>
<div class="fifth containing-block">
<div class="non-auto-margin-left non-auto-margin-right block"></div>
</div>
</body>
</html>