Stephen_Josey
Stephen_Josey

Reputation: 50

White border around single image in html document

I have a quick question, I'm making a simple html document, with an image that I want to fill the entire page.

For some reason, it wants to create a border around the image. I've tried border="0"; and padding 0px 0px 0px 0px;

Here is the code in which I have: (You can also check it out live if you prefer www.kidbomb.com/chefwannabe)

<!DOCTYPE html>
<html>
<head>
<title>Pre-Order Now!</title>
</head>
<body>

<img style="width: 100%; overflow:hidden;" src="http://www.kidbomb.com/chefwannabe/chefwannabepreview.png" />
</body>
</html>

Upvotes: 1

Views: 9593

Answers (2)

Kevin
Kevin

Reputation: 11

Instead of using the img tag, set the background-image property of the body tag so it encompasses the entirety of the page.

body { 
    background-image: url("path/to/image.jpg");    
    height: 100%;
    width: 100%;
}

Upvotes: 1

Suresh Ponnukalai
Suresh Ponnukalai

Reputation: 13988

Add the following CSS in your code. Default body will give some margin and padding. So better whenever you start new work, add this style in your css for getting the proper result.

body
{
 padding:0;
 margin:0;
}  

Upvotes: 2

Related Questions