Basic css knowledge + css Selection Characters (element Selection Characters and link selection characters), basic css knowledge

Source: Internet
Author: User

Basic css knowledge + css Selection Characters (element Selection Characters and link selection characters), basic css knowledge

First, I will introduce how to import css styles in html webpages.

1. Intra-row style: <p style = "color: red"> Use css for intra-row style </p>

2. In-page style: Set in the head label

<Span style = "font-size: 18px;"> 3. External link mode: First, you must prepare a css style sheet externally.
<Span style = "font-size: 18px; "> Next, I will introduce css cascade styles.

Element selector: class selector, id selector, class selector, and wildcard Selector

Type selector: select an element class label.

<span style="font-size:18px;"><style>        h1{        color:blue;        }</style></span>


Id selector:

<span style="font-size:18px;">


Class selector:

<span style="font-size:18px;">

Wildcard character selection:

<span style="font-size:18px;">

The type selected by the wildcard is abstract, so use it with caution!

Next, we will introduce the relationship selector, including the selector, subselector, adjacent selector, and sibling selector.

Contains the selector:

<span style="font-size:18px;">ul li{color:red;}</span>
All the li labels below ul labels are set with styles


Sub-selector:

<span style="font-size:18px;">Ol sublevel elements are selected


Adjacent selector:

<span style="font-size:18px;">Select the sibling level li element next to the li tag


Sibling selector:

<span style="font-size:18px;">Select All sibling elements behind the li tag


The above is what I want to introduce.

In addition, I would like to add a few points:

First line indent: text-indent: 4em;

Center display: teext-align: center;

Priority:

In-row css> On-page css> external css

# Id>. class

If the style set later already exists, the style set later will be overwritten.

For example:


Specifically, it must overwrite the abstract

For example, if you use the set wildcard to select a matching element selector, the part that uses the element selector will not be overwritten by the wildcard 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.