Comparison of loading CSS inline, embedded and from external files

前端 未结 10 1110
后悔当初
后悔当初 2020-12-03 18:21

We can write CSS as the following types:

  1. Inline CSS
  2. Embedded CSS
  3. External CSS

I would like to know pros and cons of each.

10条回答
  •  忘掉有多难
    2020-12-03 18:47

    Pros:

    Allows you to control the layout of the entire site with one file. Changes affect all documents at the same time. Can eliminate redundant in-line styling (Font, Bold, Color, Images) Provide multiple views of the same content for different types of users.

    Cons:

    Older browsers may not be able to understand CSS. CSS is not supported by every browser equally. In this case, the pros far outweigh the cons. In fact, if the site is designed in a specific way, older browsers will display the content much better (on average) than if the site were managed with tables.

提交回复
热议问题