


After reading this, everyone will understand the difference between class and ID selectors in CSS styles. Summary_Experience exchange
May 16, 2016 pm 12:06 PMYou can define your own selectors using the class selector and the identifier selector id.
The advantage of this is that you can represent the same HTML element differently depending on the class or id.
In CSS, the class selector is preceded by a half-width English period (.), and the id is preceded by a half-width English pound sign (#).
Looks like this:
#top { background-color: #ccc; padding: 1em } .intro { color: red; font-weight: bold; }
HTML with CSS connections use the attributes id and class. Like this:
Chocolate curry
This is my recipe for making curry purely with chocolate
Mmm mm mmmmm
The difference between id and class is that id is used on a unique element, while class is used on more than one element.
You can also apply selectors to a specific HTML element by placing the HTML selector in front, so p.jam { whatever } will be applied to paragraphs with class "jam".
An id name is usually uniquely defined in a page, so it is usually recommended to use class when defining css on a page, so that you can reuse your css. Leave the id for the most needed use JavaScript for html elements, etc.

Hot Article

Hot tools Tags

Hot Article

Hot Article Tags

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

deepseek What is the difference between r1 and v3 version

Does Bitcoin have stocks? Does Bitcoin have equity?

What is the difference between pre-market and after-market trading? Detailed explanation of the differences between pre-market and after-market trading

Why is Bittensor said to be the 'bitcoin' in the AI track?

Is there any difference between South Korean Bitcoin and domestic Bitcoin?

Pepe bought and sold out in a big way, is MUTM a smarter investment in 2025?

Vertical proxy: Application scenarios and interpretation of disruptive potential of encryption native proxy
