We would like to know how to get div tags side-by-side by float left.
<!DOCTYPE html>
<html>
<head>
<style type='text/css'>
.child_div {<!--from w ww . j a va 2s . c o m-->
float: left;
}
.parent_div {
clear: both;
}
div div {
border: thin black solid
}
</style>
</head>
<body>
<div class='parent_div'>
<div class='child_div'>text1</div>
<div class='child_div'>text2</div>
</div>
<div class='parent_div'>
<div class='child_div'>asdf</div>
<div class='child_div'>asdf</div>
<div class='child_div'>asdf</div>
</div>
</body>
</html>
The code above is rendered as follows: