<!DOCTYPE html>
<div style="width: 400px; border: 3px solid black;">
<div id="target1" style="
margin-left: 10px; width: 500px; border: 3px solid gray;
margin-right: auto;">
</div>
</div>
<div style="width: 400px; border: 3px solid black; direction: rtl;">
<div id="target2" style="
margin-right: 10px; width: 500px; border: 3px solid gray;
margin-left: auto; ">
</div>
</div>
<script src="../../resources/testharness.js"></script>
<script src="../../resources/testharnessreport.js"></script>
<script>
test(() => {
assert_equals(getComputedStyle(target1).marginRight, "-116px");
assert_equals(getComputedStyle(target2).marginLeft, "-116px");
}, "Right-aligned float in zero-width block");
</script>