css - Decrease div width on a bigger parent width -


i want div maximize size when viewport width smaller, , reduce size (up minimum) when viewport width larger.

how achieve that?

.outer {    outline: 1px solid red;    height: 128px;    min-width: 50%;    /* width: ???; set here achieve effect? */    margin: auto;  }
<div class="outer">  </div>

i tried modify padding instead of width, it's still same effect setting width % value.

.outer {    outline: 1px solid red;    height: 128px;    width: 100%;    padding: 0 10vw;  }
<div class="outer">  </div>

you can along lines of width: calc(500px - 20vw). vw smallest (creating larger value) when window small, reverse occurring in large window.


Comments

Popular posts from this blog

node.js - Node js - Trying to send POST request, but it is not loading javascript content -

javascript - Replicate keyboard event with html button -

javascript - Web audio api 5.1 surround example not working in firefox -