Source code
Revision control
Copy as Markdown
Other Tools
<!DOCTYPE html>
<html>
<head>
<title>CSS Test: Float with border, padding and margin fits next to float (reference)</title>
<link rel="stylesheet" type="text/css" href="/fonts/ahem.css">
<style>
.container {
width: 100px;
height: 40px;
font: 20px/1 Ahem;
position: relative;
}
.right {
position: absolute;
top: 0;
right: 0;
width: 50px;
height: 20px;
background: blue;
}
.left {
position: absolute;
top: 0;
left: 15px;
width: 10px;
height: 10px;
padding: 5px;
border: 5px solid green;
}
</style>
</head>
<body>
<div class="container"><div class="right"></div><div class="left"></div></div>
</body>
</html>