Home > Web Front-end > CSS Tutorial > Four ways to introduce CSS

Four ways to introduce CSS

高洛峰
Release: 2016-12-16 15:42:52
Original
1724 people have browsed it

There are three most commonly used ways to introduce CSS.

First: add in the head section to introduce external CSS document.

This method can be said to be the dominant introduction method now. Just like IE and browser. This is also the method that best embodies the characteristics of CSS; it best embodies the idea of ​​separating content and display in DIV+CSS, it is also the easiest to modify and maintain, and the code looks the most beautiful.

Second: Add


This The usage of the method is much less, and the longest one is the portal website with a large number of visits. Or the home page of a corporate website with a large number of visits. Compared with the first method, the advantages are outstanding and the disadvantages are also obvious. Advantages: fast speed, all CSS controls are for this page tag, no redundant CSS commands; and there is no need to link external CSS files. Read styles directly in HTML documents. The disadvantages are that revision is more troublesome, a single page looks bloated, CSS cannot be referenced by other HTML, resulting in a relatively large amount of code, and maintenance is also troublesome. But most of the companies that adopt this method are rich. For them, the number of users is the key, and they have no shortage of people to perform complex maintenance work.

Third: directly add

test information


This method is rarely used now, and many companies do not understand front-end technology. The leader also hates this way of writing. I think CSS commands cannot appear in HTML. In fact, it’s not a big deal if you use it sometimes. For example, in places with poor versatility, special effects, few CSS commands, and infrequent changes, this method is a good choice.

In addition to these three commonly used CSS importing methods, there is also an importing method that many people have never seen