Hi all
I have a demo here - http://www.ttmt.org.uk/float.html
It’s a <p> tag with text and three div’s below.
The <p> tag and the div’s are all floated left.
I would like the green div’s to be below the red <p> tag like
http://www.ttmt.org.uk/float_2.html
In this example I have removed the float from the <p> tag but I need to float it.
Is there a way to float all the elements and have the green div’s below the red <p> tag.
Do I need to add extra div’s around the <p> tag and div’s
<!DOCTYPE html>
<html lang="en">
<meta charset="UTF-8">
<style type="text/css">
*{
margin:0;
padding:0;
}
html,body{
background:#eee;
height:100%;
font-family:Helvetica, sans-serif;
}
.wrap{
min-height:100%;
max-width:800px;
background:#fff;
margin:0 auto;
}
p{
background:red;
color:#fff;
width:50%;
float:left;
clear:both;
margin:0 0 20px 0;
padding:10px;
}
.box{
width:100px;
height:100px;
background:green;
margin:10px;
float:left;
}
</style>
<title>Title of the document</title>
</head>
<body>
<div class="wrap">
<p>
Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.
</p>
<div class="box"></div>
<div class="box"></div>
<div class="box"></div>
</div>
</body>
</html>