The ingenious subject identifier of selector4

Source: Internet
Author: User
"My name is danran" asked in the wed group, "can I select the first element of an element for the CSS selector ?" Impressions: _ descendant
> Parent-child
+ Younger brother
~ Younger siblings
Are all backward searched .... Not found. That is, it can only be found after the reference node. The advantage of backward searching is that the direction of searching is one-way. If forward searching is supported AlgorithmA lot of trouble... However, the demand of tudan is also reasonable. I went to view the draft of css4 at night and found a similar solution:

Selector subject definition :"! "
Http://dev.w3.org/csswg/selectors4/#subject

If the browser is actually implemented, you can use the following simple sentence to meet the requirements of the earth:
! Div + # myid {color: Red}/* a DIV in front of myid is set to a red font... */

The subject definition is clever. On the one hand, it satisfies the requirements of the earth, and does not change the direction of selector. Very nice.

 

In addition, ecmascript V4 is down, so there is no reason to worry about the fate of css4...

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.