The Blog

Majestic ideas, occasional tinkering of things web and daily musings.

SUBSCRIBE TO RSS

Back to the entire list

Get Rid of Unwanted Space
Below <img>

May 30, 2012

By Syazwan Hakim

Unwanted space below <img>

Image above shows the correct styling (Left Side) and unwanted space below <img> (RightSide).

HTML Code

<a class="link" href="#">
    <img src="your image path" alt="Image" />
</a>

Style

.link {
border:1px solid red
}

Why Does It Happen?

Well, for my case, "line-height" property is the culprit. I often assign "line-height:normal;" to <body> so, I'll never miss any line-height. However, it will also cause the unwanted empty space below <img>

How to fix it?

Change "line-height" value to 0 for <a> tag.

.link {
border:1px solid red;
line-height:0
}

Syazwan Hakim is the Android Purist of Stampede Design.

An Android purist, Syazwan can be seen at his regular hangout place chanting and shrieking over Manchester United matches. At work, he matches design artwork into a fully functional website with pixel perfection. Holler to Iwan over at Twitter.

Share This Post

Be the first to comment

Leave Comment Below

Mentions

  1. There's no mention yet.

Add A Comment

Bibliophilia

Bibliophilia

The Elements of Style

by William Strunk Jr. and E.B. White

all books

Twitter

It's Friday, which means one thing at Stampede - Creative Burst! Await the blog post very soon. x

about 14 hours ago from Twitter for Mac

follow us on twitter

Contact Us

Write to us at studio@stampede-design.com
usa +1 717 7988 488   my +6 012 598 1744

© 2005-2013 STAMPEDE DESIGN. All rights reserved. No SPEC

© 2005-2013 STAMPEDE DESIGN. All rights reserved. No SPEC