What is the role of CSS selector greater than sign >

Source: Internet
Author: User

What is the role of CSS selector greater than sign >:
This section describes the effect of the greater-than sign in the CSS selector. Because of the previous browser support problems, may eat less use of selectors, but over time, the version of the update, compatibility is not a problem, so its application is also more up, the following code example to do a brief introduction.
This selector can match all of the first-level child elements of the specified element.
code example:

<!DOCTYPE HTML><HTML> <Head> <MetaCharSet= "Utf-8"> <Metaname= "Author"content= "http://www.softwhy.com/" /> <title>Ant Tribe</title><style>#box{width:200px;Height:300px;}#box > Div{width:100px;Height:100px;Background-color:Green;margin:5px;Border:1px solid Red;font-size:12px;text-align:Center;}</style></Head><Body><DivID= "box">  <Div></Div>  <Div>    <Div>Ant Tribe</Div>  </Div></Div></Body></HTML>

The above code implements our requirements by using the > selector to set the style of the first level child element under the box element.
So the "Ant tribe" string of the container div does not get the corresponding style setting.

The original address is: http://www.softwhy.com/forum.php?mod=viewthread&tid=18185

For more information, refer to: http://www.softwhy.com/divcss/

What is the role of CSS selector greater than sign >

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.