blob: 548a22d2aa48fc354da71f73f7156d8cb6963805 [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.
.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;
<body dir="rtl">
<div class="first containing-block">
<div class="auto-margin-left auto-margin-right block"></div>
<div class="second containing-block">
<div class="auto-margin-left auto-margin-right wide block"></div>
<div class="third containing-block">
<div class="auto-margin-left non-auto-margin-right block"></div>
<div class="fourth containing-block">
<div class="non-auto-margin-left auto-margin-right block"></div>
<div class="fifth containing-block">
<div class="non-auto-margin-left non-auto-margin-right block"></div>