I have been engaged in Web development for a long time, have done many projects, and have done countless daily development tasks. However, I only focus on understanding requirements and system design, however, I pay little attention to the presentation of web pages. In case of page problems, I often hand over to my colleagues in the UED department to handle them. In the long run, I have also developed inertia, regardless of the size of the page, the problem is solved by them, which not only affects the efficiency of their work, but also brings a lot of trouble to the UED colleagues. Work in the past few days is not very tight.
There are three ways to insert a style sheet:
External style sheet:
- <LINK rel = "stylesheet" type = "text/CSS" href = "mystyle.css"/>
Internal style sheet:
- <Head>
- <Style type = "text/CSS">
- HR {color: Sienna}
- P {margin-left: 20px}
- Body {background-image: URL ("images/back40.gif ")}
- </Style>
- </Head>
Inline style:
- <P style = "color: Sienna; margin-left: 20px">
- This is a paragraph
- </P>
Their priorities are from low to high. When the three styles exist simultaneously, the inline styles have the highest priority.
CSS
The syntax generally has the following forms: selector, attribute, and value: Selector {property:
Value}. If the value is a number of words, enclose the value with quotation marks, for example:
- P {text-align: center; color: black; font-family: Arial ;}
We have grouped all the title elements, such:
- H1, H2, H2, H3, H5, H6 {color: green ;}
We can also use the derived selector to limit the scope of the style, such:
- Li strong {font-style: italic; font-weight: normal ;}
Its function scope is: The style takes effect only when the <strong> label is included in the <li> label.
Id selector: Use # To define a style, for example:
- # Red {color: red ;}
- # Green {color: green ;}
Reference as ID on the page
- <P id = "red">
- This paragraph is red.
- </P>
- <P id = "green">
- This section is green.
- </P>
There are also several forms such:
- # Sidebar P {
- Font-style: italic;
- Text-align: right;
- Margin-top: 0.5em;
- }
- Div # sidebar {
- Border: 1px dotted #000;
- Padding: 10px;
- }
In CSS, the class selector is displayed with a dot:. Center {text-align: Center}, for example:
- <H1 class = "center">
- This heading will be center-aligned
- </H1>
You can also use it with the derivation tool:
- . Fancy TD {
- Color: # f60;
- Background: #666;
- }
- TD. Fancy {
- Color: # f60;
- Background: #666;
- }
Bytes
There is also a good video site, there is time to see or good http://www.caopeng.org/