1_html basic structure and style sheet

Source: Internet
Author: User

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

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.