Code:
<style> .title{ width:100%; height:50px; background-color:skyblue; font-size:20px; } </style> <div class="title"> here's my title </div>
I tried using 'padding-bottom: 5px' but then it affected the div size...
<style> .title{ width:100%; height:50px; background-color:skyblue; font-size:20px; } </style> <div class="title"> here's my title </div>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title>Untitled Document</title> <style type="text/css"> html, body { font: 14px "Comic Sans MS"; background: #FC6; text-align: center; } * { margin: 0; padding: 0; outline: none; border: none; } #container { width: 800px; margin: 30px auto; background: #999; overflow: auto; } .title { width:100%; height:50px; line-height: 50px; /*vertically centers text*/ background-color:skyblue; font-size:20px; margin: 10px 0; /*just to separate them a little*/ } .title p { text-align: left; color: #3F0; margin: 0 0 0 100px; } </style> </head> <body> <div id="container"> <div class="title"> here's my title </div> <h1 class="title">here's another title</h1> <div class="title"> <p>a third title</p> </div> <!--end container--></div> </body> </html>
Comment