Home >Web Front-end >CSS Tutorial >Can CSS Create a Masonry Layout Without JavaScript?
The masonry layout exhibits the following characteristics:
Can this layout be achieved solely through CSS?
Indeed, it is feasible with CSS3 support:
.container { -moz-column-count: 2; -moz-column-gap: 10px; -webkit-column-count: 2; -webkit-column-gap: 10px; column-count: 2; column-gap: 10px; width: 360px; } .container div { display: inline-block; width: 100%; background-color: red; }
Unfortunately, this layout requires JavaScript in the absence of CSS3 support.
The above is the detailed content of Can CSS Create a Masonry Layout Without JavaScript?. For more information, please follow other related articles on the PHP Chinese website!