ID and Class Selector
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 an HTML element that is labeled with a specific ID.
The HTML element sets the ID selector with the id attribute, and the ID selector in the CSS is defined as "#".
The following style rules apply to element properties Id= "PARA1":
Instance
#para1 {text-align:center;color:red;}
The id attribute does not start with a number, and the ID at the beginning of the number does not work in the Mozilla/firefox browser.
Class Selector
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.
The class selector is represented in the HTML as a class attribute, and in CSS, the category selector takes a point "." Number display:
In the following example, all HTML elements that have a center class are centered.
P.center {text-align:center;}
The first character of a class name cannot use a number! It doesn't work in Mozilla or Firefox.
"Recommended"
1. Special recommendation : "PHP Programmer Toolkit" V0.1 version download
2. Free CSS Online video tutorial
3. php.cn Lonely Nine-base (2)-css video tutorial