What is the syntax format of css

藏色散人
Release: 2019-06-03 16:41:10
Original
6820 people have browsed it

What is the syntax format of css

The definition of CSS consists of three parts: selector, properties, and property values.

The basic format is as follows:

selector{property:value} i.e.: (selector {property: value})

For CSS The definition of has the following requirements:

(1) Attributes and values ​​must be separated by colons. For example: body{color:blue}. The selector body refers to the main part of the page, color is the attribute that controls the text color, and black defines the color value. The effect of this example is to make the text on the page blue.

(2) If the value of an attribute consists of multiple words, the value must be enclosed in quotation marks. For example: p{font-family:"sans serif"}. In this example, the paragraph font is defined as sans serif. The name of the font consists of two words, so it must be enclosed in quotation marks.

(3) If you need to specify multiple attributes for a selector, you can use semicolons to separate all attributes and values. For example: p{text-align:center;color:red}. This example defines the arrangement of paragraphs in the play, and the text in the paragraphs is red.

(4) In order to make the defined style sheet easy to read, it is best to use a branched writing format for the definition of the style sheet. For example:

{
  text-align:center;
  color:black;
  font-family:arial
}
Copy after login

This example defines paragraph arrangement in the play. The text in the paragraph is black and the font type is arial.

The above is the detailed content of What is the syntax format of css. 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
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!