I am trying a method of centering an icon using margins.I am giving the icon a width in % and the height in % too.I have
.container{
width:600px;
height:200px;
background-color:orange;
}
img {
width:6%;
margin-left:47%;
margin-right:47%;
height:16%;
margin-top:12%;
margin-bottom:12%;
}
body{
}
The method centers the icon horizontally but not vertically.I wonder why this wont work
img {
width:6%;
margin-left:47%;
margin-right:47%;
height:16%;
margin-top:42%;
margin-bottom:42%;
}
I also have this fiddle but the margin-top and margin-bottom i have used are random http://jsfiddle.net/thiswolf/EKWWt/