Python--css Selector

Source: Internet
Author: User

CSS Selector CSS Selector

Divided into two basic selectors and a combination selector

1. Basic Selector

The basic selector is divided into four tag selectors, ID selector, class selector, wildcard selector

Tag Selector
<p>hello python</p>p{    Background-color:aqua;    Color: #99cc99;}
ID Selector
<p id= "P1" >world</p> #p1 {    background-color: #99cc99;    Font-size:larger;    Color:antiquewhite;}
Class Selector
<p class= "P2" >karina</p>.p2{    background-color: #99cc99;    Font-size:larger;    Color:bisque;}
Wildcard Selector
<p>meimei</p>*{    Background-color:bisque;    font-size:25px;;}
2. Combination Selectordescendant selectors are separated by spaces:
<style>.outer p{    color:red;}

Multi-element Selector, matching all p1,div1 tags with (,) Comma separated 

</style>.p1,.div1{    color: #99cc99;} <style>
The descendant selector is separated by the > number:
<style>.outer>p{    color:red;} </style>
Adjacent selector---down next to by + sign
<style>.outer+p{    Color:antiquewhite;} </style>
Brother tags are separated by the ~ sign
<style>.outer~p{    Color:aliceblue;} </style>

E,f   a multi-element selector that matches all E or F elements, separated by commas between E and F      :d iv,p {color: #f00;} E F   descendant element selector that matches all f elements that are descendants of the e element, separated by a space between E and F: Li a {font-weight:bold;} e > F   child element selectors, matching all e element's child elements F            :d IV > P {C Olor: #f00; }  E + f   adjoins the element selector, matching all sibling elements immediately following the E element F  :d IV + p {color: #f00;}  E ~ F   Ordinary Sibling selectors (separated by dashes)                 :. DIV1 ~ p{font-size:30px;}

Note: About label nesting

A block-level label can nest block-level labels, or inline tags can be nested

But inline tags cannot nest block-level labels

Exception: P cannot nest any block-level tags

Python--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.