Home  >  Article  >  Web Front-end  >  CSS syntax tutorial examples

CSS syntax tutorial examples

零下一度
零下一度Original
2017-05-15 11:39:381591browse

CSS Example

CSS rules consist of two main parts: selectors, and one or more declarations:

Selectors are usually HTML elements that you need to change the style of.

Each statement consists of an attribute and a value.

The property is the style attribute you wish to set. Each attribute has a value. Properties and values ​​are separated by colons.

CSS Example

CSS declarations always end with a semicolon (;), and declaration groups are enclosed in curly brackets ({}):

p {color:red; text-align:center;}

To make CSS more readable, you can describe only one attribute per line:

Example

p
{
color:red;
text-align:center;
}

CSS Comment

comments are used to explain your code, and you can edit it at will, the browser will ignore it.

CSS comments start with "/*" and end with "*/". Examples are as follows:

/*这是个注释*/
p
{
text-align:center;
/*这是另一个注释*/
color:black;
font-family:arial;
}

[Related recommendations]

1. Special recommendation: "php Programmer Toolbox" V0.1 version download

2. Free css online video tutorial

3. php.cn Dugu Jiujian (2)-css video tutorial

The above is the detailed content of CSS syntax tutorial examples. For more information, please follow other related articles on the PHP Chinese website!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn