Hey, I'm creating a small website using div tags and images, and right now I'm doing a heard for it. But I got a problem, the div tag is cut of on the sides, not using the whole screen, its not based on pixels, but on procent. I would like the image to go all the way out to the side. EDIT; Sorry for wide image. Actually it's being cut of all around it, any way to fix this in CSS?
Is that a CSS code to put in the html file? As I have a CSS file to control all that stuff. Would be good if you could explain more where to put it.
HTML code <?xml version="1.0"?> <!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"> <head> <title>Test</title> <meta http-equiv="Content-Type" content="text/html;charset=ISO-8859-1" /> <link href="index.css" type="text/css" rel="stylesheet" /> </head> <body> <div id="headertop" margin-top: 0; margin-left: 0;> </div> <div id="headerbottom"> </div> <div id="contenttop"> </div> <div id="content"> <p>Test</p> </div> </body> </html> Code (markup): CSS code body{ font-family: Arial,verdana; } #headertop{ background-image: url(images/header_top.png); background-repeat: repeat-x; width: 100%; height: 72px; border: none; margin-top: 0; padding-left: 0; } #headerbottom{ background-image: url(images/header_bottom.png); background-repeat: repeat-x; width: 100%; height: 112px; } #contentop{ background-image: url(images/content_top.png); height: 116px; width: 600px; } #content{ background-image: url(images/content.png); background-repeat: repeat-y; height: 100%; width: 600px; margin-left: auto; margin-right: auto; padding-left: 5px; padding-right: 5px; } Code (markup):
body{ font-family: Arial,verdana; margin: 0; } Code (markup): Doing this worked perfectly when I tested it. Then again, I used background colors in place of images. If that didn't work, try: img{border:0; padding: 0;} Code (markup): Are the images as big as you made the containers?
Thanks, that worked The images are just small slices, just a couple of pixels wide, they are just repeated.
Hi wanovak thanks for the code that's really work thanks for that!!! Thanks and regards http://creditcard.net.ph/
Maybe just put the margin attributes right into the body tag like this: <body leftmargin="0" topmargin="0" rightmargin="0"> Some people will poo poo this technique but it works pretty much across all browsers.
Rachel, those attributes have not been a part of the html specification since 1999, with the adoption of html4. They work only because browsers try to stay compatible with really old, outdated pages. There are no css aware browsers that do not understand body {margin: 0;}. cheers, gary