Jake Jake - 4 months ago 17
CSS Question

How to fix the height of a <div> element?

I've defined my div's height in a stylesheet:

.topbar{
width:100%;
height:70px;
background-color:#475;
}


But as soon as text is entered into the div, the divs height changes.

Any ideas?

Answer Source

change the div to display block

.topbar{
    display:block;
    width:100%;
    height:70px;
    background-color:#475;
    overflow:scroll;
    }

i made a jsfiddle example here please check

http://jsfiddle.net/TgPRM/