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

How to introduce CSS into HTML

墨辰丷
Release: 2018-05-16 11:26:59
Original
2436 people have browsed it


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 mark. This method does not reflect the advantages of CSS and is not recommended.
2. Embedded
Embedded is to write CSS styles together in the tag pair of the

tag pair of the web page. The format is as follows:

<head>
        <style type="text/css">
               ...此处写CSS样式
       </style>
      </head>
Copy after login

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

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