简体   繁体   中英

Display a div at a certain width and resize smaller when browser windows shrinks. Without Javascript

I like to display a div at width, say 900px initially and when the browser window shrinks below 900px, the div shrinks with it. I like to do this without using Javascript. I tried adding min-width:0px to the div but it didn't help.

So you want a max-width ?

By default a div is width: auto and using a standard block box, so it will expand to fill the available horizontal space. max-width will constrain it.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM