0
I want to create an HTML page with a <div>
which has a fixed height of 450px
to save text and other elements. To do this, I created a class with the following CSS properties.
.minhaClasse{
height: 450px;
max-height: 450px;
}
The problem is that the property max-height
doesn’t work when I add padding
for the element. On some HTML pages, I need to add a padding-top
item to scroll down text on page.
See the example below:
.minhaClasse{
height: 450px;
max-height: 450px;
}
<body align="center">
<div class="minhaClasse" style="padding-top: 100px;">
Meu texto dentro da DIV 100px abaixo <br>
(gostaria que a div permanecesse com 450px de altura)
</div>
</body>
As you can see, the size of the <div>
exceeds the height limit of the element. What I want to know is, how can I limit the height of my element, even adding a padding
to him ?
If you have
height: 450px;
doesn’t needmax-height: 450px;
, unless you’re using some form of diplay other thanblock
, what seems improbable.– Guilherme Nascimento
Why use/not use * box-Sizing? https://answall.com/questions/100623/por-que-usar-n%C3%A3o-usar-box-Sizing
– hugocsl