I'm trying to make the following div flexible
div {
min-width: 500px;
max-width: 1000px;
width:100%;
height: 400px;
margin-left:100px
}
If I remove the margin left everything works fine, but with the margin, when I start resizing the browser window, the box goes behind the browser window and only then starts being resized. How do I solve this issue? I tried a wrapper, tried resetting box-sizing, tried with different positionings but nothing seems to work, what am I missing?
Try adding
width: calc(100vw-100px);
orcalc(100% - 100px)
. This sets the width of the div to Veiwport width - MarginAlso remove
max-width: 1000px;
andmin-width: 500px;