HTML CSS examples for CSS Layout:Box
Fit the inner box inside the outer box
<html> <head> <meta name="viewport" content="width=device-width, initial-scale=1"> <style id="compiled-css" type="text/css"> #mainDiv {<!-- w ww . j a va 2s . c om--> width:1201px; margin:0 auto; background-color:Chartreuse; } #leftDiv, #rightDiv { height:601px; margin:0px; } #leftDiv { width:25.67%; background-color:yellow; display:inline-block; } #rightDiv { width:76%; background-color:blue; display:inline-block; } #box1, #box2, #box3, #box4 { height:151px; } #box1 { background-color:pink; } #box2 { background-color:OrangeRed; } #box3 { background-color:grey; } #box4 { background-color:BlueViolet; } </style> </head> <body> <div id="mainDiv"> <div id="leftDiv"> <div id="box1"></div> <div id="box2"></div> <div id="box3"></div> <div id="box4"></div> </div> <div id="rightDiv"></div> </div> </body> </html>