[css] 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?

This question is related to css html

The answer is


You can try max-height: 70px; See if that works.


You can also use min-height and max-height. It was very useful for me


If you want to keep the height of the DIV absolute, regardless of the amount of text inside use the following:

overflow: hidden;