View Full Version : Margins CSS

07-21-2011, 03:38 AM
I'm creating a website I have little Css experience. I simply have an image that is my site (jpg file). I would like this image to have no margins, padding etc when it is viewed in the browser.

When I open my browser (Safari) I get a huge amount of white space on the right side as well as at the bottom.

I have attempted to select the body tag and add a css rule to have 0 borders or padding yet I am still left with a large amount of white space.

Can anyone provide me some help with resolving my issue ? I would be willing to offer some of my illustration services for resolving this issue.

<!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">
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<title>Untitled Document</title>
<style type="text/css">
.e {
margin: 0px;
padding: 0px;
body {
margin: 0px;
padding: 0px;


<img src="2011 Website/home_lab.jpg" width="1522" height="1025" />

07-21-2011, 05:24 AM
To style your image you will have to either give it a class name and style the class or style all img tags using img { } (or you can, of course, style your image directly with the style attribute). Also, you should check to make sure there's no whitespace in your image; I've had times where it took me a while to realize that the reason I couldn't make the whitespace go away was because it was in the image and not part of the page itself.

07-21-2011, 08:59 AM
thanks to both my friend. i also need it for image setting...

07-21-2011, 09:20 AM
Use below given code. It will set padding and margin to 0 for all elements. If you want to padding or margin to any element, you can set for it.