search
  • Sign In
  • Sign Up
Password reset successful

Follow the proiects vou are interested in andi aet the latestnews about them taster

HTML+CSS Easy to Get Started with Selectors

What is the inclusion selector

The inclusion selector, that is, adding spaces, is used to select descendant elements under the specified label element

Syntax:

body div{

Style

}

Example:

<!DOCTYPE html>
<html>
<head>
	<meta charset="utf-8">
	<title>包含选择器</title>
	<style type="text/css">
			body div li{
				color:red;
			}
	</style>
</head>
<body>
		<div>中华民族伟大复兴!
			<ul>
				<li>中国</li>
				<li>中国</li>
			</ul>
		</div>

		<p>你知道我的梦,知道我的痛,知道我们感受都相同</p>

		<span>最美的太阳
		        <p>强军梦</p>
		</span>

		<h3>中国梦</h3>
</body>
</html>

If I want to set the font of "Strong Army Dream" to size 20 , the color is blue, what should be done

Add the following code to the css:

body span p{

font-size:20px;

color:blue;

}

new file
<!DOCTYPE html> <html> <head> <meta charset="utf-8"> <title>包含选择器</title> <style type="text/css"> body div li{ color:red; } </style> </head> <body> <div>中华民族伟大复兴! <ul> <li>中国</li> <li>中国</li> </ul> </div> <p>你知道我的梦,知道我的痛,知道我们感受都相同</p> <span>最美的太阳</span> <h3>中国梦</h3> </body> </html>
Reset Code
Automatic operation
submit
Preview Clear