/*Comment area*/This is the comment syntax
1. Style sheet (I) Classification of style sheets 1. Inline style sheetIt is displayed in conjunction with HTML, with accurate control, but poor reusability and more redundancy.
Example: <p style=font-size:14px;>Inline stylesheet</p>
2. Embed style sheetAs an independent area embedded in the web page, it must be written in the head tag.
<style type=text/css>
p //Format works on p tag
{
style;
}
</style>
3. External style sheetCreate a new CSS file to place the style sheet. If you want to call a style sheet in an HTML file, you need to right-click → CSS style sheet → Attached style sheet in the HTML file. Generally, link connection is used.
Note: There is no need to write style tags in the css file
Some tags have default margins, which are generally removed first when writing style sheet code (other styles can be set), as follows:
Note: The above picture is to remove margins and spacing first.
(II) Selector 1. Tag selector. Use the label name as a selector. 2. class selector. They all start with . Note: The class selector can be superimposed with the label selector to show different effects. 3. ID selector. Start with # . Note: The ID selector can be superimposed with the tag selector to show different effects.<div id=style name>
4.Composite selector(1) Use, separate, and indicate parallelism.
(2) Separate it with spaces to represent descendants.
(3) Filter.
2. Style properties (I) Background and Foreground 1. Background:2. Foreground font: (II) Borders and borders border (table border, style, etc.), margin (outside table spacing). padding (content and cell spacing). (III) List and Block width , height , ( top , bottom , left , right ) is only useful in absolute coordinates. CSS stylesheet code displays:
CSS file code:
CSS Code Copy content to clipboard