开发者

Inline-block + min/max-width behavior

开发者 https://www.devze.com 2023-02-17 12:02 出处:网络
I see in many browsers (FF,Opera,Ie) that elements I give them \"inline-block\" and \"min/max width\" , their width isautomatically sets to \"min-width\", and not max-width, as expected.

I see in many browsers (FF,Opera,Ie) that elements I give them "inline-block" and "min/max width" , their width is automatically sets to "min-width", and not max-width, as expected. Is that normal behavior?

Can I solve it in css way (inline-block el开发者_如何学Pythonement with max-width)? (I know about floats/tables/js, there are some reasons i need do it in this way)

here is the code


You are encountering a valid behavior. min-width means that the width cannot be less than the min-width value. On the other hand, max-width means that the width cannot exceed the max-width value (but it can be less). Thus if you specify both min-width and max-width on an empty element, its width is set to min-width.

0

精彩评论

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

关注公众号