I have image wrapped in a link. The link adds extra padding in the bottom (Please see the red area in the attached image). How can I remove it? I have tried to set the padding: 0;
and margin:0
and also I have tried display:inline-block
, but it does not solve it.
HTML:
<a href="#"><img src="http://i50.tinypic.com/2poy3kl.jpg" /></a>
CSS:
a{
background: red;
padding: 0;
}
JS Fiddle: http://jsfiddle.net/D6Ak8/
Use display: block;
for the img
tag:
a img {
display: block;
}
显示块是您的解决方案JS提琴
Add vertical-align:bottom
to your image. This way you will keep your inline display.
try
img{border:none;}
...............
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.