master maste
New Member
- Reaction score
- 32
I have been trying for awhile to get my image positioned in the center, when I use a background image it works when I do this:
But when I put the image in the html and try center it like this:
It does not work, it puts the left margin of the picture at 50%, is there a way I can put the image in the middle of the page without specifying it in pixels, and not having it as a background (so I can make it a link).
Code:
#div {
background: url(images/header.jpg) no-repeat 50% 0%;
height: 250px;
}
But when I put the image in the html and try center it like this:
Code:
#div img {
padding-left: 50%;
height: 250px;
}