April 5, 201016 yr On this design when I try to add padding to the text using CSS, the light gray background moves too. What am I doing wrong?
April 5, 201016 yr Have you got your code your code you can post up? You can add padding to the light grey box say 10px on the left but then reduce the width of the box by the same amount to keep it the same size.
April 5, 201016 yr Author #container { width: 900px } #floatright { float: right; } #header { width: 900px; height: 200px; background-color: black; border-bottom: 2px solid #000000; font-size: 200px; font-family: Helvetica; color: orange; } #nav { float: left; width: 170px; height: 400px; background-color: gray; border-right: 1px dashed white; font-family: Tahoma; font-size: Small; } #body { width: 900px; height: 400px; background-color: #b9b9b9; } #body a { color: white; text-decoration: none; font-weight: bold; font-family: Tahoma; font-size: small; } #body a:visited { color: white; text-decoration: none; font-weight: bold; font-family: Tahoma; font-size: small; } #body a:hover { color: orange; } #section { width: 170px; background-color: white; font-family: Tahoma; font-size: small; font-weight: bold; } #footer { clear: both; background-color: gray; font-family: Tahoma; font-size: Small; } .box { margin-top: 10px; padding: 5px 5px 5px 5px; background-color: #dddddd; border: 2px solid red; width: 350px; color: black; } Basically, I want the text inside "body" to be padded so that it isnt touching the edge.
April 5, 201016 yr If you just want padding to all paragraphs you need to put text inbetween <p>your text here</p> css p{padding:10px;} hth
April 5, 201016 yr you can use firebug http://getfirebug.com/ and use trial and error method to learn things
April 5, 201016 yr Author Using <p> offsets the background. <html> <head> <style type="text/css"> </style> <link href="style.css" rel="stylesheet" type="text/css"> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en"> </head> <body background="dots.gif"> <div id="container"> <div id="header"> <div id="floatright"><img src="photo.png"></div></div> <div id="nav"> <div id="section">navigation</div> Links here </div> </div> <div id="body"> Sed ut perspiciatis unde omnis iste natus error sit voluptatem accusantium doloremque laudantium, totam rem aperiam, eaque ipsa quae ab illo inventore veritatis et quasi architecto beatae vitae dicta sunt explicabo. Nemo enim ipsam voluptatem quia voluptas sit aspernatur aut odit aut fugit, sed quia consequuntur magni dolores eos qui ratione voluptatem sequi nesciunt. Neque porro quisquam est, qui dolorem ipsum quia dolor sit amet, consectetur, adipisci velit, sed quia non numquam eius modi tempora incidunt ut labore et dolore magnam aliquam quaerat voluptatem. Ut enim ad minima veniam, quis nostrum exercitationem ullam corporis suscipit laboriosam, nisi ut aliquid ex ea commodi consequatur? Quis autem vel eum iure reprehenderit qui in ea voluptate velit esse quam nihil molestiae consequatur, vel illum qui dolorem eum fugiat quo voluptas nulla pariatur? </div> <div id="footer"> Copyright info</div> </div> </body> </html> Here's the HTML.
April 5, 201016 yr Author OK, I've got padding to work now using positioning tags on the body section: But now the image is at the back. How to I bring it to the front again? EDIT: Done it using z-index tag. Solved.
Create an account or sign in to comment