Height with min and max in percentage x auto

Asked

Viewed 75 times

0

I have a div, and your Heightis at 90%, but if you decrease the height of the browser the content goes out of the div, how can I keep you from div? I thought I’d use height-min:auto and height-max:90% but it doesn’t happen. but if I leave with height:auto, but for my content would not be ideal.

inserir a descrição da imagem aqui

The top part in blue, would be the div with the size of 90% the white part is only a margin between the div, the black part is another div. The phrase up to the selected words (in blue in black) belongs to divblue.

Códigos

divAzul

.div4 {
    background: -webkit-linear-gradient(top, #088fad 20%, #00d5ff 100%);
    margin-top: 4em;
    padding: 2em;
    border-radius: 1em;
    width: 100%;
    height: 90%;
}

DivPreta

.div5 {
    margin-top: 4em;
    padding: 5em 3em 3em 3em;
    background: #000000;
    border-radius: 1em;
    width: 100%;
    height: 70%;
}

I’m adding these images to better understand:

shorter in height: inserir a descrição da imagem aqui

taller: inserir a descrição da imagem aqui

  • But what do you want to happen with content? Is it hidden? Does the font decrease? The text keeps the DIV to the minimum size to be displayed completely?

  • 1

    give a look here: http://www.w3schools.com/cssref/pr_pos_overflow.asp. You may find the desired solution. Here it is possible to test: http://www.w3schools.com/cssref/playit.asp?filename=playcss_overflow

  • @mauhumor, I just want the div to be the minimum size of the text, and the maximum size 90% of the screen, I’ll look at the links, obg

  • I added a few more images to better understand

No answers

Browser other questions tagged

You are not signed in. Login or sign up in order to post.