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-002.html - WPT Dashboard Interop Dashboard
<!DOCTYPE html>
<html>
<head>
<title>CSS Test: Left float with margin-left fits next to right float</title>
<link rel="match" href="float-avoids-float-with-margin-002-ref.html">
<link rel="stylesheet" type="text/css" href="/fonts/ahem.css">
<meta name="assert" content="A left float whose margin box fits next to a right float should remain on the same line.">
<style>
.container {
width: 100px;
height: 40px;
font: 20px/1 Ahem;
}
.right {
float: right;
width: 40px;
height: 20px;
background: blue;
}
.left {
float: left;
width: 20px;
height: 20px;
background: green;
margin-left: 20px;
}
</style>
</head>
<body>
<div class="container">
<div class="right"></div>
<div class="left"></div>
</div>
</body>
</html>