Home  >  Article  >  Web Front-end  >  Introduction to CSS

Introduction to CSS

巴扎黑
巴扎黑Original
2017-07-19 16:28:401375browse

1. Overview
Cascading style sheets; can control the elements of HTML to make the display effect and position of HTML elements better;

2. Basic syntax
css rules are composed of Composed of two parts: selector and statement
Statement rules:
1. The name of the css selector is case-sensitive; the attribute name and attribute value are case-sensitive;
2. Use at the end of each statement ;, the last line can be omitted;
3. Comment format: /**/
4.css code written in HTML needs to be wrapped with style tags;
5. If you write a separate css file, There is no need to use the style tag, and all statements need to be wrapped in braces;
6. If the attribute value contains spaces, it must be wrapped in double quotes;
7. If an attribute name corresponds to multiple attribute values , multiple attribute values ​​separated by spaces;
8.css file suffix name.css;

3. Format:
Selector{
Attribute name: attribute value;
Attribute name: Attribute value;
Attribute name: Attribute value;
.........................
}

4. Selector
1.ID Attribute value of selector
#id{
Attribute name: attribute value;
Attribute name: attribute value;
.....
}

2. Class Attribute value of selector
.class attribute {
Attribute name: attribute value;
Attribute name: attribute value;
.....
}

3. Element selector (tag selector)
Tag name{
Attribute name: attribute value;
Attribute name: attribute value;
.....
}

4. Attribute selector
Tag name [attribute name = attribute value]{
Attribute name: attribute value;
....
}

5. Contain selector
Basic selector tag name{
Attribute name: attribute value;
....
}

4. How to integrate with html
1. In the head of html Use link tag

2. In html Use the style tag in the head tag of the page, and you can also write css code in the style tag; it can only be used in this html file, not other html;

3. In the opening tag, write the attribute name style= "Attribute name = attribute value; attribute name = attribute value;";

The above is the detailed content of Introduction to CSS. 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