Blogger Information
Blog 87
fans 0
comment 0
visits 59067
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
第五节课:CSS基本选择器
黄忠倚的博客
Original
538 people have browsed it

实例

<!DOCTYPE html>
<html lang="en">
<head>
	<meta charset="UTF-8">
	<title>0321作业:基本选择器和属性选择器</title>
	<style type="text/css">
		ul {
			padding: 0;
			margin: 0;
			width: 500px;
			border: 1px dashed #666;
			padding: 10px 5px;
		}
		ul:after {
			content: '';
			display: block;
			clear: both;
		}
		li {
			list-style: none;
			float: left;
			width: 40px;
			line-height: 40px;
			text-align: center;
			border-radius: 50%;
			background-color: skyblue;
			margin-right:5px;
		}
		
		/*id选择器*/
		#item1 {
			background-color: red;
		}
		/*类选择器*/
		.green {
			background-color: lightgreen;
		}
		/*父子选择器*/
		ul li {
			color: white;
		}
		/*通配选择器*/
		ul * {
			/*border: 1px solid black;*/
		}
		/*子元素选择器*/
		ul > li {
			background-color: blue;
		}
		/*相邻兄弟选择器*/
		#item2 + li {
			/*background-color: black;*/
		}
		#item2 ~ li {
			background-color: black;
		}
		/*-------------------------------*/

	</style>
</head>
<body>
	<ul>
		<li id="item1">A</li>
		<li class="green">B</li>
		<li class="green">C</li>
		<li>D</li>
		<li>E</li>
		<li id="item2">F</li>
		<li>G</li>
		<li>H</li>
		<li>I</li>
		<li>J</li>
	</ul>
</body>
</html>

运行实例 »

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

手抄代码:

  • wx_camera_1521824461401.jpgwx_camera_1521824478333.jpgwx_camera_1521824497825.jpgwx_camera_1521824508147.jpg

Correction status:Uncorrected

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