CSS Quick Start-combo Selector

Source: Internet
Author: User

<Divclass= "Gradefather">Hello1<Divclass= "Father">Hello2<Pclass= "Son">Hello4</P>    </Div>    <P>Hello3</P>    <P>Hello5</P></Div>

I. A, B: arbitrary selector A or
div,p {    #所有div或者p标签font-size:10px;color:blue;}

Second, a B: descendant selector, all B under a tag
Div p {#div下所有p标签font-size:20px;color:green;}

Third, A>b: Sub-selector, only the son level will be selected.
gradefather>p {#gradefather的子标签, only Hello3 hello5 will function font-size:20px;color:red;}. father>p {#father的子标签, only Hello4 will function font-size:20px;color:red;}

Four, A+b: adjacent to the selector, only adjacent to the same level (brother sibling) The first one will be selected.
#father的第一个邻居, only Hello3 will function Font-size:20px;color:green;}

Attention:
1. Block-level elements can contain inline elements or some block-level elements, but inline elements cannot contain block-level elements, which can contain only other inline elements. Block-level labels take one row by default, and inline labels occupy a space of content size.
2. There are several special block-level elements that can contain only inline elements and cannot contain block-level elements. such as H1,h2,h3,h4,h5,h6,p,dt
3, Li can contain div
4. Block-level elements are tied to block-level elements, inline elements and inline elements.

CSS QuickStart-combining selectors

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.