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

CSS syntax tutorial examples

零下一度
Release: 2017-05-15 11:39:38
Original
1662 people have browsed it

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;
}
Copy after login

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;
}
Copy after login

[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!

Related labels:
source:php.cn
Statement of this Website
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
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template