Summary of class usage and specifications

巴扎黑
Release: 2017-06-07 16:46:30
Original
2387 people have browsed it

In CSS, we often see the selector class, so let’s make a summary of the usage and specifications of class:

1.Introduction to CSS Id and Class selector

id and class selectors

If you want to set CSS styles in HTML elements, you need to set the "id" and "class" selectors in the element.

id selector

The id selector can specify a specific style for HTML elements marked with a specific id.

The HTML element uses the id attribute to set the id selector, and the id selector in CSS is defined with "#".

Summary of class usage and specifications

2.The difference between a.class and a.class, pay attention to the spaces - CSS debugging skills

Use picture sprite technology This problem occurs when positioning pictures. Sometimes a space can cause many problems. This article introduces the difference between a.class and a.class with examples.

Summary of class usage and specifications

3.Detailed explanation of the principle of using both id and class in css

First, introduce the difference between id and class:

 id is a label used to distinguish different structures and contents; id is to find the structure/content first, and then define a style for it; class is a style that can be applied to any structure and content; class is defined first Use one style and apply it to multiple structures/contents.

Summary of class usage and specifications

4.Introduction to common naming conventions for page layout classes

This article mainly provides an in-depth analysis of page layout classes for everyone. Information related to common naming conventions has certain reference value. Interested friends can refer to

Summary of class usage and specifications

5.The difference between id and class, use class Or ID

In the previous two articles, we talked about the relevant knowledge and how to use class and id respectively, but in actual projects, how should we choose, class or id?

Let’s review the differences between the two first!

ID is unique and class is universal, so the same id can only be used once on a page, while class can be used without restriction.

Summary of class usage and specifications

The above is the detailed content of Summary of class usage and specifications. For more information, please follow other related articles on the PHP Chinese website!

Related labels:
source:php.cn
Statement of this Website
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
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!