July 15, 2010

Div max-height too tall

Question by mag725

I am doing some of my first web dev, and had a question about the max-height css property.

Here’s my code:

div{
     max-height:10px; 
}

Whenever I create a new div, everything works fine, but when I add any sort of other element between the div tags, the height of the div increase by around 10 pixels (I’m guessing). Is there any way to override this? I want to have a div with text in it where there is almost no border around the text.

Thanks for any help!
-Matt

Answer by Starx

Sometimes even the default font-size affect the division height. so try overflow:hidden or font-size:10px.

I think this can solve your problem

...

Please fill the form - I will response as fast as I can!