1 <!DOCTYPE html PUBLIC
"-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
4 <title>CSS Test: Absolutely positioned non-replaced elements when both 'margin-left' and 'margin-right' are set to 'auto' and direction is left-to-right
</title>
5 <link rel=
"author" title=
"Microsoft" href=
"http://www.microsoft.com/">
6 <link rel=
"help" href=
"http://www.w3.org/TR/CSS21/visudet.html#abs-non-replaced-width">
7 <meta name=
"flags" content=
"ahem">
8 <script src=
"../../resources/ahem.js"></script>
9 <meta name=
"assert" content=
"When direction is 'ltr' and 'left', 'width' and 'right' are not 'auto', solve for 'margin-right' and 'margin-left' to equal values. If this would make 'margin-left' and 'margin-right' negative, then set 'margin-left' to zero and solve for 'margin-right'.">
10 <style type=
"text/css">
33 + margin-left : solve (auto)
34 + border-left-width : 0
38 + border-right-width : 0
39 + margin-right : solve (auto)
41 ====================================
42 width of containing block : 2in
44 So, margin-left and margin-right would be each -0.5in at this point.
46 "...unless this would make them (the two margins) negative in which case when direction of the containing block is 'ltr' ('rtl'), set 'margin-left' ('margin-right') to zero and solve for 'margin-right' ('margin-left')."
48 So, under such extra constraint, 'margin-left' must become 0 and 'margin-right' must become -1in.
53 <p>Test passes if the blue box fills the upper-right corner of the black box and there is no red visible on the page.
</p>