首页 > Web开发 > 详细

css 中的column-width 和 column-count

时间:2019-11-03 11:50:51      阅读:84      评论:0      收藏:0      [点我收藏+]

这两个属性都可以实现多列布局,但是column-width 是响应式的,它可以在小屏幕上自动显示为单列布局

所以指定column-width 比column-count好

<!DOCTYPE html>
<html>
	<head>
		<meta charset="UTF-8">
		<title></title>
		<style type="text/css">
			.clm {
				column-width: 300px;
			}
			
			.clm div {
				break-inside: avoid;
			}
		</style>
	</head>
	<body>
		
		<div class="clm">
		<div class="" style="width: 31px; height: 43px; background: red;"></div>
		<div class="" style="width: 33px; height: 53px; background: yellow;"></div>
		<div class="" style="width: 63px; height: 36px; background: blue;"></div>
		<div class="" style="width: 64px; height: 64px; background: black;"></div>
		<div class="" style="width: 45px; height: 27px; background: lightblue;"></div>
		<div class="" style="width: 54px; height: 67px; background: lightcoral;"></div>
		<div class="" style="width: 54px; height: 67px; background: lightcoral;"></div>
		<div class="" style="width: 67px; height: 98px; background: lightcyan;"></div>
		<div class="" style="width: 23px; height: 78px; background: lightgoldenrodyellow;"></div>
		<div class="" style="width: 54px; height: 23px; background: lightgray;"></div>
		<div class="" style="width: 78px; height: 89px; background: lightsalmon;"></div>
		</div>
	</body>
</html>

  

css 中的column-width 和 column-count

原文:https://www.cnblogs.com/lilei-site/p/11785298.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!