CSS ~ And +

Source: Internet
Author: User

I used to think css is not so powerful. Today I suddenly found out...

Cough .. Cough ..

Which of the following is tested? ^_^

Of course it is not so comprehensive. Please give your comments!

OK,

~ (W3c China not found)

Role:

For example:

1 <span class = "t"> top </span> 2 <div> 3 <span class = "t"> inside </span> 4 </div> 5 <span class = "t"> Number 1 </span> <br/> 6 <span class = "t"> Number 2 </span>

Now we add a style to him: div ~ . T {color: red ;}

So who will change? That's right. The numbers 1 and 2 are red.

+

Purpose: To be followed at the same level (must be followed)

If we change the style to. t ~ . T {color: red ;}

Who has changed?

The answer is, there is no element chain that meets this rule.

Now, remove <br/> from the html code.

RUN!

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.