CSS3 Basic Syntax

Source: Internet
Author: User

First, the basic grammar

1,css Introduction Method

<link rel= "stylesheet" type= "Text/css" href= "Styles.css" >

2,CSS writing format

h1,h2{Color:blue;font_size}

Two, derive selectors:

Defines the context style based on the element's position relationship.

For example: We only want the strong in Li to change its style to red, while the strong of P does not change.

<p><strong>p strong</strong></p> <ul> <li><strong>li STRONG</STRONG&G T;</li> </ul>

Li strong{color:red;}

Three, ID base selector

The 1,id selector can be identified by an HTML page labeled with an ID. Use # to define.

<p id= "Id1" >id testttttt</p>

#id1 {color:pink;}

The 2,id selector and the derived selector work together

<p id= "Id1" >id testttttt<a href= "aasdfasf" >www.baidu.com</a></p>

#id a{Color:blue;}

four, class selector;

Displayed at a point. He can also be used as a derivative selector

<p class= "Pclass" > This is the class tag ah </p>//css. pclass{color:red;}

He can also make derivative selectors to use.

Five, Property selector:

Sets the style for the HTML element with the specified style.

<p title= "F" >shuxingxuanzeqiadafsadf</p>//css <style type= "Text/css" > [title]{color:red; } </style>

Properties and value selectors.

<p title= "F" >shuxingxuanzeqiadafsadf</p> <p title= "KK" >shuxingxuanzeqiadafsadf</p>//css     <style type= "Text/css" > [title]{color:red;     } [title= "KK"]{color:blue; } </style>

CSS3 Basic Syntax

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.