We would like to know how to center div with floating divs aside.
<!DOCTYPE html>
<html>
<head>
<style type='text/css'>
.header {<!--from w w w. jav a 2 s. c o m-->
background-color: #f0f0f0;
height: 20px;
left: 0;
position: fixed;
top: 0;
width: 100%;
}
.float {
width: 20px;
}
.a, .b, .c {
float: left;
}
.d, .e {
float: right;
}
.centered {
background-color: #ddd;
left: 50%;
margin-left: -100px;
position: absolute;
text-align: center;
width: 200px;
}
</style>
</head>
<body>
<div class="header">
<div class="float a">
<a href="">a</a>
</div>
<div class="float b">
<a href="">b</a>
</div>
<div class="float c">
<a href="">c</a>
</div>
<div class="float d">
<a href="">d</a>
</div>
<div class="float e">
<a href="">e</a>
</div>
<div class="centered">centered</div>
</div>
</body>
</html>
The code above is rendered as follows: