HTML CSS examples for CSS Layout:Position
CSS position layer on top - margin & padding, overflow issues
<html> <head> <meta name="viewport" content="width=device-width, initial-scale=1"> <style id="compiled-css" type="text/css"> .content_box {<!--from ww w. j a v a 2s.c o m--> padding:26px; border:2px SOLID Chartreuse; border-radius:3px; } .red_area { display:block; position:relative; margin:0 auto; text-align:center; background:red; width:51%; } .cb_container .content_box h3 { margin:0 0 16px 0; font-size:18px; line-height:16px; } </style> </head> <body> <div class="cb_container"> <div class="red_area"> Lorem <br>Lorem <br>Lorem <br>Lorem <br>Lorem <br>Lorem <br>Lorem <br>Lorem <br> </div> <div class="content_box extra_padding_bottom"> <h3>Lorem ipsum dolor </h3>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Morbi ullamcorper molestie lacus sed fermentum. Aliquam erat volutpat. Vestibulum tortor neque, ornare vitae tempor hendrerit, luctus at neque. Phasellus sed quam pharetra, tinc </div> </div> </body> </html>