First, the basic structure of HTML:
<title> title of the page </title>
<body>
Body: can display the contents of a Web page
</body>
Second, there are four ways to add HTML styles:
The first type:
Inline style sheet
<div id="round" style="width:400px; height:300px; "> <p> I am the Test text </p></div>
Advantages:
Highest priority, no conflicts with other styles
Disadvantages:
Not conducive to maintenance, no commonality, poor code readability
The second type:
Internal style sheet (written in header <style> tag)
<style> #b1 { width:200px; height:200px; BORDER:2PX solid red;} </style>
Advantages:
1. No extra code in a single page
2. Reduce external requests
3. In a single page can be common
Disadvantages:
1. No way to reuse the entire project
2. Later the whole project style change, change the inconvenience
The third type:
External style sheet (using link to introduce an external separate CSS file into HTML)
<link rel="stylesheet" href="css/index.css" />
Advantages:
1. Easy to modify and maintain the whole project
2. Multiple pages can be reused
Disadvantages:
1. Poorly planned, easy code conflict
2. There will be extra code on a single page
3. External requests are increased
The fourth type:
Import (in the style sheet, introduce a new style sheet):
Not recommended, poor performance, cannot be loaded concurrently
1_html basic structure and style sheet