html - Set div width and resize when it doesn't fit on the screen for absolute positioned div -
i trying set fixed width div, example 200px. want div have 200px, except when current window has not enough space it.
div { border: 2px solid; } .fixedwidth { width: 200px; position: absolute; } .nowidth { position: absolute; }
<div class="fixedwidth"> lalala lala lalala lalala </div> <br /> <br /> <div class="nowidth"> alala lala alal lala </div>
then following problem can seen when screen gets smaller:
the first div not resize , text falls outside screen.
i noticed, behaviour trying achieve max-width normal div, doesn't work absolute positioned divs.
since normal divs possible without media queries, searching solution without media queries, not sure if possible.
you should able following:
.fixedwidth { max-width:200px; width: 100%; }
this mean 200px until screen not large enough
Comments
Post a Comment