Home >Web Front-end >Front-end Q&A >What does wildcard mean in css

What does wildcard mean in css

青灯夜游
青灯夜游Original
2021-12-09 11:28:145168browse

The wildcard is represented by an asterisk "*", which means "all" and is a selector in CSS; it has the widest scope among all selectors in CSS and can match all elements on the page. , the syntax is "*{property name:property value;...}".

What does wildcard mean in css

The operating environment of this tutorial: Windows 7 system, CSS3&&HTML5 version, Dell G3 computer.

The wildcard is represented by the asterisk "*", which means "all" and is a selector in CSS.

The wildcard selector "*" has the widest scope of all selectors and can match all elements on the page.

Basic grammar format

What does wildcard mean in css
Example 1

Here I write three choices The selectors are element selector, id selector, and class selector. The HTML code is as follows

	<div>寄言燕雀莫相唣,自有云霄万里高。</div>
	<span id="myId">人生不得行胸怀,虽寿百岁犹为无也。</span>
	<p class="myClass">如果你想攀登高峰,切莫把彩虹当作梯子。</p>

Then we use the wildcard selector to set all text colors to blue. The CSS code is as follows

	* {color: blue;}

The browser running effect is as follows

What does wildcard mean in css

As you can see, we did not set the CSS style for each selector, but the text color of each selector was also changed to Blue, this is the wildcard selector.

Example 2

For example, the following code uses wildcard selectors to define CSS styles and clear the default margins of all HTML tags.

	* {
    	margin:0;   /*清除外边距*/
    	padding: 0; /*清除内边距*/
	}

(Learning video sharing: css video tutorial)

The above is the detailed content of What does wildcard mean 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