当前位置: 动力学知识库 > 问答 > 编程问答 >

css - Narrow down contained elements if they are to wide to fit in a container

问题描述:

Let's assume there is a fixed-width div container, 200px wide. Contained elements are fixed-width inline-block divs, 45px wide. Then let's assume I add one more element to the container. What I would like to achieve is that all the contained elements shrink to maximum possible width and fit in the container without overflowing (40px, assuming there is no whitespace between the elements).

Is this possible with pure CSS?

网友答案:

It is possible with pure CSS3 using the flexbox module. Finding adequate browser support for it is another matter unfortunately.

See it in action (if you are on FF/Chrome/Safari).

分享给朋友:
您可能感兴趣的文章:
随机阅读: