Source code
Revision control
Copy as Markdown
Other Tools
Test Info:
- This WPT test may be referenced by the following Test IDs:
- /css/CSS2/floats/float-avoids-float-with-margin-009.html - WPT Dashboard Interop Dashboard
<!DOCTYPE html>
<html>
<head>
<title>CSS Test: Left float with negative margin-left next to right float</title>
<link rel="match" href="float-avoids-float-with-margin-009-ref.html">
<link rel="stylesheet" type="text/css" href="/fonts/ahem.css">
<meta name="assert" content="A left float with negative margin-left has a smaller margin box and should fit next to a right float when margin box width allows it.">
<style>
.container {
width: 100px;
height: 40px;
font: 20px/1 Ahem;
}
.right {
float: right;
width: 60px;
height: 20px;
background: blue;
}
.left {
float: left;
width: 50px;
height: 20px;
background: green;
margin-left: -20px;
}
</style>
</head>
<body>
<div class="container"><div class="right"></div><div class="left"></div></div>
</body>
</html>