4

I have a DIV that is 100% width..... inside a grid system .. the total grid is 1140px..

anyway inside the div that is 100% i inserted a image...

problem is if the div background is black... there is like 1cm at the bottom that still shows the black color.

like this

http://jsfiddle.net/hb3QK/3/

<div style="background:black; width:100%;">
  <img src="http://i42.tinypic.com/ofq9tg.png" >

should i be using a float on the image? or using a display:block?

1
  • 1
    The 1cm gap is because <img> is display: inline by default. Switching to display: block will remove it. Commented Dec 8, 2013 at 2:47

3 Answers 3

13

here you do http://jsfiddle.net/cancerian73/hb3QK/4/

img {
    height: auto; /* Make sure images are scaled correctly. */
width: 100%; /* Adhere to container width. */
display:block;
 }
Sign up to request clarification or add additional context in comments.

Comments

9

add display: block; to style of image.

3 Comments

i just said the required part, setting height auto is not required as its default
indeed, but your answer definitely came second, and San's answer is more than enough.
it is not important who's came first or second...as long as it helps someone....cheers people :)
0

or you can add if you need to keep it inline. line-height: 0; to the image style.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.