Blogger Information
Blog 8
fans 0
comment 0
visits 4176
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
3月21日作业
王科的博客
Original
462 people have browsed it

代码:

实例

<!DOCTYPE html>
<html lang="en">
<head>
	<meta charset="UTF-8">
	<title>3.伪类选择器</title>
	<style type="text/css">
		
		ul {   
			padding: 0;
			margin: 0;
			width: 450px;
			border: 1px dashed #666;
			padding: 10px 5px;
		}

		ul:after {  
			content:'';  
			display: block; 
			clear:both;   
		}
		
		li { 
			list-style: none; 
			float: left;  
			width: 40px;  
			height: 40px; 
			line-height: 40px;
			text-align: center; 
			border-radius: 50%; 			
			background: skyblue; 
			margin-right: 5px; 
		}

		ul li:first-child {
			background-color: brown;
		}


		ul li:last-child {
			background-color: lightgreen;
		}

		p:only-of-type {
			
			color:red;
		}
</style>
</head>
<body>
	<ul>
		<li id="item1">1</li>
		<li class="green">2</li>
		<li class="green red">3</li>
		<li class="red">4</li>
		<li>5</li>
		<li id="item2">6</li>
		<li class="php">7</li>
		<li class="php css">8</li>
		<li>9</li>
		<li>10</li>
	</ul>

	<div>
		<p>我是当前div元素中的唯一子元素</p>
	</div>
	<div>
		<p>我是当前div元素中的第一个子元素</p>
		<p>我是当前div元素中的第二个子元素</p>
	</div>
	<div>
		<p>我虽然是div下唯一的类型为p的子元素</p>
		<h4>我是div下的另一个子元素h4</h4>
	</div>
</body>
</html>

运行实例 »

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


Correction status:qualified

Teacher's comments:
Statement of this Website
The copyright of this blog article belongs to the blogger. Please specify the address when reprinting! If there is any infringement or violation of the law, please contact admin@php.cn Report processing!
All comments Speak rationally on civilized internet, please comply with News Comment Service Agreement
0 comments
Author's latest blog post