MENU service case
 Website construction website design Beijing website construction high-end website production company Shangpin China
We create by embracing change
360 ° brand value__
simplified Chinese character
Simplified Chinese English

Shangpin China Joins Hands with Beisheng Internet to Create a New Chapter in Website Construction

Type: Shangpin Dynamic Learn more

What are the common ways for HTML to introduce CSS?

Source: Shangpin China | Type: website encyclopedia | Time: May 23, 2019
We all know that HTML and CSS are two different languages, but they can work on a web page at the same time. Web Page=content (html)+presentation (css)+behavior (javascript). Therefore, CSS needs to be introduced into HTML for use together. To display the expected CSS style sheet effect in the browser, the browser must recognize and correctly call CSS. When the browser reads the style sheet, it should be read according to the text format. When the CSS style sheet is placed in different places, the scope of action is different. In HTML, CSS is mainly introduced in four ways: inline, embedded, imported, and linked.
 
 
(1) In line formula, as shown below:
    
That is, the CSS style is set in the style attribute of the tag. This method does not reflect the advantages of CSS in essence, so it is not recommended.
 
    (2) Embedded , as shown below:
    
 
Write in the settings of various elements in the page
It is convenient for a single page between and. However, the use of this method is much less, and the longest one is the portal website with a large number of visitors. Or the home page of the enterprise website with a large number of visitors. Compared with the first method, it has obvious advantages and disadvantages. Advantages: fast, all CSS controls are for the page tags, and there are no redundant CSS commands; Moreover, no external chain CSS file is needed. Read styles directly in HTML documents. The disadvantage is that it is more troublesome to change the version. A single page appears bloated. CSS cannot be referenced by other HTML, resulting in a relatively large amount of code. Maintenance is also more troublesome. However, most companies that adopt this method have money. For them, user volume is the key, and they do not lack people to carry out complex maintenance work.
 
(3) Imported , as shown in the figure below
 
    (4) Linked, as shown below:
    
The import mode is similar to the link mode, which is to import CSS files from outside. However, the effect of link mode will be better for client users when browsing the website.
Linking can be said to be the dominant method of introduction. Just like IE and browser. This is also the best way to reflect the characteristics of CSS; It can best reflect the idea of separating content from display in DIV+CSS, and is also the easiest to revise and maintain. The code looks the most beautiful.
 
Summary: For some large websites, in order to facilitate maintenance, you may want to classify all CSS styles into several CSS files. In this way, if you use connected import, you need to import several statements into CSS files separately. If you want to adjust the classification of CSS files, you need to adjust HTML files at the same time. This is a defect for maintenance work. If you use import mode, you can import only one general CSS file, and then import other independent CSS files into this file; Linking does not have this feature.
Source Statement: This article is original or edited by Shangpin China's editors. If it needs to be reproduced, please indicate that it is from Shangpin China. The above contents (including pictures and words) are from the Internet. If there is any infringement, please contact us in time (010-60259772).
TAG label:

What if your website can increase the number of conversions and improve customer satisfaction?

Make an appointment with a professional consultant to communicate!

* Shangpin professional consultant will contact you as soon as possible

Disclaimer

Thank you very much for visiting our website. Please read all the terms of this statement carefully before you use this website.

1. Part of the content of this site comes from the network, and the copyright of some articles and pictures involved belongs to the original author. The reprint of this site is for everyone to learn and exchange, and should not be used for any commercial activities.

2. This website does not assume any form of loss or injury caused by users to themselves and others due to the use of these resources.

3. For issues not covered in this statement, please refer to relevant national laws and regulations. In case of conflict between this statement and national laws and regulations, the national laws and regulations shall prevail.

4. If it infringes your legitimate rights and interests, please contact us in time, and we will delete the relevant content at the first time!

Contact: 010-60259772
E-mail: [email protected]

Communicate with professional consultants now!

  • National Service Hotline

    400-700-4979

  • Beijing Service Hotline

    010-60259772

Please be assured to fill in the information protection
Online consultation

Disclaimer

Thank you very much for visiting our website. Please read all the terms of this statement carefully before you use this website.

1. Part of the content of this site comes from the network, and the copyright of some articles and pictures involved belongs to the original author. The reprint of this site is for everyone to learn and exchange, and should not be used for any commercial activities.

2. This website does not assume any form of loss or injury caused by users to themselves and others due to the use of these resources.

3. For issues not covered in this statement, please refer to relevant national laws and regulations. In case of conflict between this statement and national laws and regulations, the national laws and regulations shall prevail.

4. If it infringes your legitimate rights and interests, please contact us in time, and we will delete the relevant content at the first time!

Contact: 010-60259772
E-mail: [email protected]