Home  >  Article  >  Web Front-end  >  How to introduce CSS into HTML

How to introduce CSS into HTML

高洛峰
高洛峰Original
2016-12-16 15:38:402103browse

There are four main ways to introduce CSS in HTML, they are inline, embedded, link and imported.

1. Inline style
      Inline style is to set the CSS style in the style attribute of the tag. This method does not reflect the advantages of CSS and is not recommended.
2. Embedded
Embedded is to write CSS styles centrally in the tag pair of the tag pair of the web page. The format is as follows:                                                                                                                                                                   

Disadvantages For a website that contains many web pages, it is very troublesome to use embedding in each web page to modify the style. Single web pages can consider using embeds.

3. Import method

Introduction of an independent .css file into the HTML file. The import method uses CSS rules to introduce external CSS files. The