开发者

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

开发者 https://www.devze.com 2023-01-08 17:11 出处:网络
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 th开发者_如何转开发is without using Javascript. I tried add

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 th开发者_如何转开发is 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.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号