When we are building the website, we must design the content of the website in style. So what do we need to do to set CSS styles in HTML elements? Here we need to set the ID and class selector in the HTML element. That some novice friends may ask, CSS class how to use? Does the DIV tag use ID or class?
This article will give you a description of the CSS class selector ID and class usage and differences. It is hoped that the description of the ID and class-readable points will help.
First, the CSS class selector ID code uses the following example:
<! DOCTYPE html>
Effects such as:
Second, the CSS class selector class Code use example is as follows:
<! DOCTYPE html>
Effects such as:
Third, the combination of ID and class is the above two methods together.
It is important to note that:
ID plus prefix "#"; ID a page can only be used once;
The ID selector can specify a specific style for an HTML element that is labeled with a specific ID.
Class can be referenced multiple times with the "." Class.
The class selector is used to describe the style of a set of elements, which differs from the ID selector, and class can be used in multiple elements.
So through this article about CSS. Class#id The introduction of these two selectors, I hope the novice in the tangle with the class or ID when it is helpful.