博客列表 >CSS居中布局总结——2018年3月23日

CSS居中布局总结——2018年3月23日

JackBlog
JackBlog原创
2018年03月25日 10:02:04405浏览

QQ截图20180325100139.jpg

实例

<!DOCTYPE html>
<html>
	<head>
		<meta charset="utf-8" />
		<title></title>
		<style type="text/css">
			.text1{
				width: 200px;
				height: 200px;
				background-color: burlywood;
				text-align: center;		
				float: left;	
			}
			.text1 a{
				line-height: 200px;
			}
			
			.test2{
				width: 200px;
				height: 200px;
				background-color: coral;
				text-align: center;
				display: table-cell;
				vertical-align: middle;
				
			}
			
			.test3{
				width: 200px;
				height: 200px;
				background-color: cadetblue;
				display: table-cell;
				vertical-align: middle;
				
				
			}
			.test3 .test3-1{
				width: 100px;
				height: 100px;
				background-color: chocolate;
				margin: auto;
			}
			
			.test4{
				width: 200px;
				height: 200px;
				background-color: chartreuse;
				text-align: center;
				display: table-cell;
				vertical-align: middle;
				
			}
			.test4 li{
				display: inline;
				list-style: none;
				
			}
			.test4 ul{
				margin: 0;
				padding: 0;
			}
		</style>
	</head>
	<body>
		<div class="text1">
			<a href="">床前明月光</a>
		</div>
		
		<div class="test2">
			<a href="">床前明月光</a><br>
			<a href="">疑是地上霜</a>
		</div>
		
		<div class="test3">
			<div class="test3-1"></div>
		</div>
		
		<div class="test4">
			
			<ul>
				<li>1</li>
				<li>2</li>
				<li>3</li>
				<li>4</li>
				<li>5</li>
			</ul>
		</div>
	</body>
</html>

运行实例 »

点击 "运行实例" 按钮查看在线实例

QQ截图20180325163336.jpg

上一条:3月23日作业下一条:0322课后作业
声明:本文内容转载自脚本之家,由网友自发贡献,版权归原作者所有,如您发现涉嫌抄袭侵权,请联系admin@php.cn 核实处理。
全部评论
文明上网理性发言,请遵守新闻评论服务协议