博客列表 >3.21标签选择器

3.21标签选择器

十一
十一原创
2018年03月22日 14:35:24732浏览

基本选择器:

实例

<!DOCTYPE html>
<html lang="en">
<head>
	<meta charset="UTF-8">
	<title>基本选择器</title>
	<style type="text/css">
	h1{
		size: 44px;
		color:red;
	}
	#t1{
		size: 22px;
		color: yellow;background-color: green
	}
	.green{
		size: 58;background-color: yellow
	}
	ol li{
		size: 35;color:DarkMagenta;
		 }
	tr * {
		background-color: red
	}
	ul > li{
		color:#8B0000;
	}
	</style>
</head>
<body>
	<h1 style="color: blue">元素选择器</h1>
	<ul type="none">
		<li id="t1">ID选择器/#加ID值</li>
		<li class="green">类选择器1/.+class值</li>
		<li class="red">3</li>
		<li class="green">类选择器2</li>
		<li>5</li>
		<li id="t2">6</li>
		<li>7</li>
		<li>8</li>
		<li>9</li>
		<li>10</li>
	</ul>
	<ol>
		<li>父子选择器</li>
		<li>父子选择器</li>
		<li>父子选择器</li>
		<li>父子选择器</li>
	</ol>
<table border="1">
	<tr>
		<th>通配选择器</th>
		<th>通配选择器</th>
		<th>通配选择器</th>
	</tr>
</table>
<dl>
	<dt>子元素选择器</dt>
	<dd>子元素选择器</dd>
</dl>
</body>
</html>

运行实例 »

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

实例

<!DOCTYPE html>
<html lang="en">
<head>
	<meta charset="UTF-8">
	<title>基本选择器2</title>
	<style type="text/css">
	ol > li{
		font-size: 67px;color: red;
	}
	#t2 + li{
		background-color: blue;color: red
	}
	#t3 ~ li{
		color: skyblue
	}

	</style>
</head>
<body>
		<h1 style="color: blue">元素选择器</h1>
	<ul type="none">
		<li id="t1">ID选择器/#加ID值</li>
		<li class="green">类选择器1/.+class值</li>
		<li class="red">3</li>
		<li class="green">类选择器2</li>
		<li>5</li>
		<li id="t2">6</li>
		<li>相邻兄弟选择器</li>
		<li id="t3">8</li>
		<li>全部兄弟选择器</li>
		<li>全部兄弟选择器</li>
		<li>全部兄弟选择器</li>

	</ul>
	<ol>
		<li>子元素选择器</li>
		<li>子元素选择器</li>
		<li>子元素选择器</li>
		<li>子元素选择器</li>
	</ol>
<table border="1">
	<tr>
		<th>通配选择器</th>
		<th>通配选择器</th>
		<th>通配选择器</th>
	</tr>
</table>
</body>
</html>

运行实例 »

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

属性选择器

实例

<!DOCTYPE html>
<html lang="en">
<head>
	<meta charset="UTF-8">
	<title>属性选择器</title>
	<style type="text/css">
		* [id] {
		size: 44px;color: red;
		}
		li[class="green"]{
			size:55px;background: red;

		}
		li[class~="red"]{
			color: blue
		}
		li[class ^= "ph"] {
			background-color: coral;
		}
		li[class $= "s"]{
			color:skyblue
		}
		li[class *= "a"]{
			background-color: lime;
		}
			</style>

</head>
<body>
		<ul type="none">
		<li id="item1">根据属性名来选择“id属性”</li>
		<li class="green">根据属性名与值来选择</li>
		<li class="green red">选择class属性值中包括指定单词的元素RED</li>
		<li class="red">选择class属性值中包括指定单词的元素red</li>
		<li class="abc">选择属性值中包括指定字母'a'的类样式元素</li>
		<li id="item2">根据属性名来选择“id属性”</li>
		<li class="php">选择以'ph'字母开头的class类样式元素</li>
		<li class="php css">选择以'ph'字母开头的class类样式元素+选择以's'结尾的类样式元素</li>
		<li>9</li>
		<li>10</li>
	</ul>
</body>
</html>

运行实例 »

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

手抄基础选择器

QQ图片20180322192556.jpg

QQ图片20180322192608.jpg

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