"CSS Selector"

Source: Internet
Author: User

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"

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.