兩種css外部檔案的引用方式

來源:互聯網
上載者:User
目前有兩種引用方式,一種是通過在head裡面的link來引用,另外一種是直接通過import來引用,範例程式碼如下,需要的朋友不要錯過

css外部檔案的引用可分為兩種,一種是通過在<head></head>裡面的link來引用,另外一種是直接通過import來引用。例子如下所示
第一種引用

代碼如下:

<link rel="stylesheet" href="/css/mycss.css" />

第二種引用

代碼如下:

@import url(/css/mycss.css)

這種引用可以將引用的代碼放在任何<body></body>位置

以上就是本文的全部內容,希望對大家的學習有所協助,更多相關內容請關注topic.alibabacloud.com!

相關文章

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.