1. Tag Selector
All of the tags will be added to this effect
<!DOCTYPE HTML PUBLIC "-//w3c//dtd HTML 4.01 transitional//en" "Http://www.w3.org/TR/html4/loose.dtd "><HTML><Head> <Metahttp-equiv= "Content-type"content= "Text/html;charset=utf-8"> <title>Tag Selector</title> <styletype= "Text/css">P{font-size:40px;Color:Red;Font-weight:Bold; } </style></Head><Body> <P>Test Text 1</P> <P>Test Text 2</P></Body></HTML>
2. Class Selector
Class selectors can work on different label elements at the same time
<!DOCTYPE HTML PUBLIC "-//w3c//dtd HTML 4.01 transitional//en" "Http://www.w3.org/TR/html4/loose.dtd "><HTML><Head> <Metahttp-equiv= "Content-type"content= "Text/html;charset=utf-8"> <title>Class Selector</title> <styletype= "Text/css">. Blue{font-size:40px;Color:Red;Font-weight:Bold; } </style></Head><Body> <Pclass= "Blue">Test Text 1</P> <H1class= "Blue">This is the H tag</H1> <P>Test Text 2</P></Body></HTML>
Multiple class selectors can be used in a tag to achieve the effect of composite use,
<!DOCTYPE HTML PUBLIC "-//w3c//dtd HTML 4.01 transitional//en" "Http://www.w3.org/TR/html4/loose.dtd "><HTML><Head> <Metahttp-equiv= "Content-type"content= "Text/html;charset=utf-8"> <title>Class Selector</title> <styletype= "Text/css">. Red{Color:Red; }. Big{font-size:32px; } </style></Head><Body> <Pclass= "Red">Red</P> <Pclass= "Big">Big.</P> <Pclass= "Red Big">The Big red.</P></Body></HTML>
3.id Selector
Each ID name can be used only once. The basic role of the ID selector is to define the unique elements that appear in each page.
<!DOCTYPE HTML PUBLIC "-//w3c//dtd HTML 4.01 transitional//en" "Http://www.w3.org/TR/html4/loose.dtd "><HTML><Head> <Metahttp-equiv= "Content-type"content= "Text/html;charset=utf-8"> <title>ID Selector</title> <styletype= "Text/css">#red{Color:Red; }#big{font-size:32px; } </style></Head><Body> <PID= "Red">Red</P> <PID= "Big">Big.</P></Body></HTML>
"CSS Selector"