HTML使用栅格布局实现六种筛子样式的代码详解

ID:16253 / 打印

先上效果图下面附上代码

在这里插入图片描述
在这里插入图片描述

在这里插入图片描述

 <!DOCTYPE html> <html>  	<head> 		<meta charset="UTF-8"> 		<title></title> 		<style type="text/css"> 			.big { 				width: 100px; 				height: 100px; 				background: skyblue; 				display: flex; 				margin-top: 20px; 			}  			.small { 				width: 10px; 				height: 10px; 				background: purple; 				border-radius: 5px; 			} 			 			.one { 				display: flex; 				justify-content: center; 				/*交叉轴*/ 				align-items: center; 			} 			 			.two { 				display: flex; 				justify-content: space-around; 				align-items: center; 			} 			 			.two2 { 				display: flex; 				flex-direction: column; 				justify-content: space-around; 				align-items: center; 			} 			 			.three { 				display: flex; 				flex-direction: column; 				justify-content: space-between; 				align-items: center; 			} 			 			.four { 				display: flex; 				justify-content: space-around; 			} 			 			.four1 { 				display: flex; 				justify-content: space-around; 				align-items: center; 			} 			 			.four2 { 				display: flex; 				flex-direction: column; 				justify-content: space-around; 				align-items: center; 			} 			 			.five { 				display: flex; 				justify-content: space-around; 			} 			 			.five1 { 				display: flex; 				flex-direction: column; 				justify-content: space-around; 				align-items: center; 			} 			 			.five2 { 				display: flex; 				flex-direction: row; 				align-self: center; 			} 			 			.six { 				display: flex; 				justify-content: space-around; 			} 			 			.six1 { 				display: flex; 				flex-direction: column; 				justify-content: space-around; 				align-items: center; 			} 		</style> 	</head>  	<body> 		<div class="big one"> 			<div class="small"></div> 		</div> 		<div class="big two"> 			<div class="small"></div> 			<div class="small"></div> 		</div> 		<div class="big two2"> 			<div class="small"></div> 			<div class="small"></div> 		</div> 		<div class="big three"> 			<div class="small" style="align-self: flex-start;"></div> 			<div class="small" style="align-self: center;"></div> 			<div class="small" style="align-self: flex-end;"></div> 		</div> 		<div class="big three"> 			<div class="small" style="align-self: flex-end;"></div> 			<div class="small" style="align-self: center;"></div> 			<div class="small" style="align-self: flex-start;"></div> 		</div> 		<div class="big four"> 			<div class="four2">  				<div class="small"></div> 				<div class="small"></div> 			</div> 			<div class="four2">  				<div class="small"></div> 				<div class="small"></div> 			</div> 		</div> 		<div class="big five"> 			<div class="five1">  				<div class="small"></div> 				<div class="small"></div> 			</div> 			<div class="five2">  				<div class="small"></div> 			</div> 			<div class="five1">  				<div class="small"></div> 				<div class="small"></div> 			</div> 		</div>  		<div class="big six"> 			<div class="six1"> 				<div class="small"></div> 				<div class="small"></div> 				<div class="small"></div> 			</div> 			<div class="six1"> 				<div class="small"></div> 				<div class="small"></div> 				<div class="small"></div> 			</div> 		</div> 		<div class="big six"> 			<div class="six1"> 				<div class="small"></div>  				<div class="small"></div> 			</div> 			<div class="six1"> 				<div class="small"></div> 				<div class="small"></div>  			</div> 			<div class="six1"> 				<div class="small"></div> 				<div class="small"></div>  			</div> 		</div> 	</body>  </html>

总结

上一篇: HTML+CSS+JS模仿win10亮度调节效果的示例代码
下一篇: 如何为 Element UI 里的 autosize textarea 设置高度

作者:admin @ 24资源网   2024-11-04

本站所有软件、源码、文章均有网友提供,如有侵权联系308410122@qq.com

与本文相关文章

发表评论:

◎欢迎参与讨论,请在这里发表您的看法、交流您的观点。