HTML CSS examples for CSS Layout:Float
Aligning a floated div to the parent div
<html> <head> <meta name="viewport" content="width=device-width, initial-scale=1"> <style id="compiled-css" type="text/css"> body {<!--from ww w .j ava 2 s. c o m--> width:701px; margin:21px auto; } #container { border:6px solid Chartreuse; } #firstDiv { border:6px solid yellow; width:251px; float:left; } #secondDiv { border:6px solid blue; } </style> </head> <body> <div id="container"> <div id="firstDiv"> FIRST Div inside CONTAINER </div> <div id="secondDiv"> SECOND Div inside CONTAINER </div> </div> </body> </html>