You know the profile of CSS, we need to know to understand the syntax of CSS is the syntax in the theme of how you mean. Understand the syntax of CSS will be the first step to help you master CSS can create or edit the theme to theme according to your blog.
1. Syntax
Of a CSS syntax is made up of three parts: selector (seclector), Attribute (property) and value (value). And be written in the following standards:
Selector {property: value} - selector {property: value}
- Selector: usually HTML tags or elements that you want to specify as: body, header, content, sidebar, footer, etc..
- Property and Values: Attributes are the properties that you want to assign. Attribute is always accompanied by our values and separated by a colon ":".
For example:
Body {font: Arial}
A selector can have multiple attributes, each attribute separated by a semicolon ";".
For example:
Body {
font: arial;
color: # D3D4D5;
background: # 3EDF42;
}
If value is a long word to indicate a certain name, you must put them in quotes.
For example:
P {font-family: "sans serif"}
2. The selected group together
You can choose to have the same group together attribute to the short syntax. The selectors are separated from each other by a comma ",".
For example, you group the elements h1, h2, h3, h4 header with the same color of blue and the font is Tahoma together
h1, h2, h3, h4 {
color: blue;
font: Tahoma;
}
3. Captions in CSS
You can add captions to your code, it will help you know the code that performs any task or nothing. Comments will help you easily remember what I wrote before. Captions will not display the browser.
A comment begins with a trailing "/ *" and end with a trailing "*/". You can put the notes anywhere you want.
For example:
/ * This is the Sidebar * /
# Sidebar {
with: 300px;
padding: 10px;
font: Tahoma, Verdana;
}
Or
# Sidebar {
/ * This is the Sidebar * /
with: 300px;
padding: 10px;
font: Tahoma, Verdana;
}
Or
# Sidebar {
with: 300px; / * The width of the Sidebar * /
padding: 10px;
font: Tahoma, Verdana;
}
Poster : chánh Văn
Viewed : 1595