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-008.html - WPT Dashboard Interop Dashboard
<!DOCTYPE html>
<html>
<head>
<title>CSS Test: Left float with border, padding and margin-left fits next to right float</title>
<link rel="match" href="float-avoids-float-with-margin-008-ref.html">
<link rel="stylesheet" type="text/css" href="/fonts/ahem.css">
<meta name="assert" content="A left float whose margin box (including border and padding) 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: 50px;
height: 20px;
background: blue;
}
.left {
float: left;
width: 10px;
height: 10px;
padding: 5px;
border: 5px solid green;
margin-left: 15px;
}
</style>
</head>
<body>
<div class="container"><div class="right"></div><div class="left"></div></div>
</body>
</html>