Home  >  Article  >  Web Front-end  >  3 ways to use CSS

3 ways to use CSS

藏色散人
藏色散人forward
2020-05-24 13:45:543123browse

3 ways to use CSS

(1) Link type: (externally imported .css file)

(used more often) 2cdf5bf648cf2f33323966d7f58a7f3f is referenced before the html is loaded

Introduce external style sheets using 2cdf5bf648cf2f33323966d7f58a7f3f in the 93f0f5c25f18dab9d176bd4f6de5d30e9c3bca370b5104690d9ef395f2c5f8d1 tag pair of the web page, and use html rules to introduce external css:

   <link href="./css/style.css" rel="stylesheet" type="text/css"/>

Import type: (external import. css file) 

(not used) @import is referenced only after the html is loaded, and styles cannot be inserted into the JS DOM model

Introducing external CSS files, the c9ccee2e6ea535a969eb3f532ad9fe89 tag is also written In the 93f0f5c25f18dab9d176bd4f6de5d30e tag, the syntax used is as follows:

     <style type="text/css">
        @import "./css/style.css"
          /*@import url(./css/style.css)*/
      </style>

(2) Embedded

is written directly under the 100db36a723c770d327fc0aef2ce13b1 tag, often in 93f0f5c25f18dab9d176bd4f6de5d30e3c7b149cc556f883a18b3c490b028d4e,

Advantages: fast, all CSS controls are for this page tag, and styles are read directly in the HTML document;

Disadvantages: A single page looks bloated and cannot be Being referenced by other HTML results in a relatively large amount of code and maintenance trouble

<style type="text/css">
      div{border:1px #ff0 solid}
    </style>

(3) Inline

(not recommended) It can be used in locations that are not frequently changed

<div style="border:1px #ff0 solid;">内容</div>

The above is the detailed content of 3 ways to use CSS. For more information, please follow other related articles on the PHP Chinese website!

Statement:
This article is reproduced at:cnblogs.com. If there is any infringement, please contact admin@php.cn delete