I have a div with id leftheader and I want to position an image within the div at its centre. I am trying this css
#leftheader {
float: left;
width: 28%;
height: 140px;
margin: auto;
}
#leftheader img {
/*padding-left: 80px;*/
}
When I use padding-left: 80px;, I get the centre alignment of the image. But since I have used % in the width of leftheader, I dont want to use pixel values. Can anyone suggest me a more generic css layout.
If you use the text-align :center; your image should center itself in the div.