Pixel
Pixel

Reputation: 106

Div height issue

I'm having an issue with height of a div element in my code.

Take a look at this example: http://jsfiddle.net/qUfr8/
...and now this: http://jsfiddle.net/DdUbr/

Pay attention on the red border. It's fine in the first example, but not in the second.
The only difference between those examples is that I added two div elements to the second code and now the height of content is equal to 0, but the content is still displayed, though.

How I can fix this issue?

Upvotes: 2

Views: 114

Answers (2)

Bruno Valentino
Bruno Valentino

Reputation: 1

Another way to fix it is adding "display: inline-block" to your #content:

http://jsfiddle.net/DdUbr/6/

Upvotes: 0

Ollie
Ollie

Reputation: 656

You need to use a clear fix if your floating elements inside a div

http://www.webtoolkit.info/css-clearfix.html

jsFiddle example: http://jsfiddle.net/DdUbr/2/

Upvotes: 3

Related Questions