Home >Web Front-end >JS Tutorial >Is there any difference in spaces between two class selectors in CSS?

Is there any difference in spaces between two class selectors in CSS?

一个新手
一个新手Original
2017-09-26 10:03:592016browse

The difference between two class selectors in css is whether there are spaces or not:

##

<!DOCTYPE html>
<html>
	<head>
		<meta charset="UTF-8">
		<title></title>
		<style>
			.p1.p2{width: 100px;height: 100px;background: red;}/*多类选择器*/
			.p1 .p2{width: 100px;height: 100px;background: yellow;}/*后代选择器*/
		</style>
	</head>
	<body>
		<p class="p1 p2"></p>
		<p class="p1">
		    <p class="p2"></p>	
		</p>	
	</body>
</html>



Conclusion: There is no space between two class selectors in cssForm Multi-class selector , has spaces to form a descendant selector .

The above is the detailed content of Is there any difference in spaces between two class selectors in CSS?. For more information, please follow other related articles on the PHP Chinese website!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn