Blogger Information
Blog 16
fans 1
comment 0
visits 9913
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
0403作业
烟火的博客
Original
426 people have browsed it

实例

<!DOCTYPE html>
<html lang="en">
<head>
	<meta charset="UTF-8">
	<title>选择器</title>
	<style type="text/css">

		table, td {
			border:1px solid green;
		}


		table {
			width: 75%;
			margin: 20px auto;
			border-collapse: collapse;
			text-align: center;
		}

		table caption {
			font-size: 1.8em;
			margin-bottom: 15px;
		}


		.bg-orange {
			font-weight: bolder;
			color: white;
			background-color: orange;
		}
	</style>
</head>
<body>
	<table>
		<caption>用户信息表</caption>

		<tr id="title">
			<td>01</td>
			<td>02</td>
			<td>03</td>
			<td>04</td>
			<td>05</td>
			<td>06</td>
			<td>07</td>
			<td>08</td>
			<td>09</td>
			<td>10</td>
		</tr>
		<tr>
			<td>01</td>
			<td>02</td>
			<td>03</td>
			<td>04</td>
			<td>05</td>
			<td>06</td>
			<td>07</td>
			<td>08</td>
			<td>09</td>
			<td>10</td>
		</tr>
		<tr class="choose">
			<td>01</td>
			<td>02</td>
			<td>03</td>
			<td>04</td>
			<td>05</td>
			<td>06</td>
			<td>07</td>
			<td>08</td>
			<td>09</td>
			<td>10</td>
		</tr>
		<tr>
			<td>01</td>
			<td>02</td>
			<td>03</td>
			<td>04</td>
			<td>05</td>
			<td>06</td>
			<td>07</td>
			<td>08</td>
			<td>09</td>
			<td>10</td>
		</tr>
		<tr class="choose">
			<td>01</td>
			<td>02</td>
			<td>03</td>
			<td>04</td>
			<td>05</td>
			<td>06</td>
			<td>07</td>
			<td>08</td>
			<td>09</td>
			<td>10</td>
		</tr>
		
		
	</table>
</body>
</html>
<!-- 基本格式都是一样的,套用css的样式即可 -->
<script type="text/javascript" src="../js/jquery-3.3.1.js"></script>
<script type="text/javascript">
	//1. tag标签选择器
	$('td').css('backgroundColor','lightblue')

	//2.id选择器
	//把td上的背景去掉,否则会层叠覆盖
	$('#title').css('backgroundColor','lightgreen')

	//3.class类选择器
	$('.choose').addClass('bg-orange')

	//4.*通配选择符
	$('tr:nth-child(3) ~ *').css('font-size', '1.5em')


</script>

运行实例 »

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


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
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!