html平均分配子元素的方法

<!DOCTYPE html>
<html>

	<head>
		<meta charset=" utf-8">
		<meta name="author" content="http://www.softwhy.com/" />
		<title>互聯網工做者</title>
		<style>
			* {
				margin: 0px;
				padding: 0px;
			}
			
			ol {
				width: 100%;
				/*width: 800px;*/
				display: table;
				table-layout: fixed;
				/* the magic dust that ensures equal width */
				background: #ccc
			}
			
			ol> li {
				display: table-cell;
				border: 1px dashed red;
				text-align: center
			}
		</style>
	</head>
	<body>
		<ol>
			<li>Item 1</li>
			<li>Item 2</li>
			<li>Item 3</li>
			<li>Item 4</li>
		</ol>
	</body>

</html>
相關文章
相關標籤/搜索