CSS universal and grouped selectors (10)_html/css_WEB-ITnose
1. Universal Selector
The universal selector may be the most powerful of all selectors, but it is the least used. A universal selector acts like a wildcard, matching all available elements. Universal selectors are represented by an asterisk. Universal selectors are generally used to apply styles to all elements on the page
For example: you can use the following rule to delete the default white space border on the element
*{margin:0;padding:0;}
2. Group selector
Group selector is not a selector type, but a method of using a selector. When multiple objects define the same style, they can be grouped into a group, which can simplify the code.
/*定义所有级别的标题和段落行高为22px*/h1,h2,h3,h4,h5,h6,p{ line-height:22px;}
Group selector, you can use commas to separate different objects in the same group. Group selectors are somewhat similar to class selectors in that they can both define the same style for different elements or objects.
Change the following styles
.class1{ font-size:13px; color:red; text-decoration:underline; }.class2{ font-size:13px; color:blue; text-decoration:underline; }
The grouping selector uses
.class1{ color:red; }.class2{ color:blue; } /*共同样式*/.class1,class2{ font-size:13px; text-decoration:underline; }
The grouping selector sticks to the following two A principle

Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

Video Face Swap
Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Article

Hot Tools

Notepad++7.3.1
Easy-to-use and free code editor

SublimeText3 Chinese version
Chinese version, very easy to use

Zend Studio 13.0.1
Powerful PHP integrated development environment

Dreamweaver CS6
Visual web development tools

SublimeText3 Mac version
God-level code editing software (SublimeText3)

Hot Topics

HTML is suitable for beginners because it is simple and easy to learn and can quickly see results. 1) The learning curve of HTML is smooth and easy to get started. 2) Just master the basic tags to start creating web pages. 3) High flexibility and can be used in combination with CSS and JavaScript. 4) Rich learning resources and modern tools support the learning process.

HTML defines the web structure, CSS is responsible for style and layout, and JavaScript gives dynamic interaction. The three perform their duties in web development and jointly build a colorful website.

WebdevelopmentreliesonHTML,CSS,andJavaScript:1)HTMLstructurescontent,2)CSSstylesit,and3)JavaScriptaddsinteractivity,formingthebasisofmodernwebexperiences.

AnexampleofastartingtaginHTMLis,whichbeginsaparagraph.StartingtagsareessentialinHTMLastheyinitiateelements,definetheirtypes,andarecrucialforstructuringwebpagesandconstructingtheDOM.

GiteePages static website deployment failed: 404 error troubleshooting and resolution when using Gitee...

To achieve the effect of scattering and enlarging the surrounding images after clicking on the image, many web designs need to achieve an interactive effect: click on a certain image to make the surrounding...

HTML, CSS and JavaScript are the three pillars of web development. 1. HTML defines the web page structure and uses tags such as, etc. 2. CSS controls the web page style, using selectors and attributes such as color, font-size, etc. 3. JavaScript realizes dynamic effects and interaction, through event monitoring and DOM operations.

The Y-axis position adaptive algorithm for web annotation function This article will explore how to implement annotation functions similar to Word documents, especially how to deal with the interval between annotations...
