引入css的方式

2022-03-06 14:58:59 字數 376 閱讀 7166

---恢復內容開始---

引入css的樣式及link和@import的區別

有3種引入方式

1.內部樣式(寫在標籤內)

2.內聯樣式

3.外部樣式(link @import)

區別:1.本質區別:link由html提供;@import由css提供,link可引用其他檔案,@import只能引用css檔案

2.載入順序的區別:link與html同時被載入,@import在html載入完成之後再載入,這樣使用者體驗不好

3.相容性的區別:@import是css2.1提出,只能在ie5以上才能支援,link無此要求

4.控制dom時的區別:link支援;@import不支援

---恢復內容結束---

CSS的引入方式

通過style標籤屬性,寫入css 這種方式一般不用,因為html和css是分離的,而且他的權重最高,就算css 單獨寫了,一旦用了行內樣式就會覆蓋掉我們以前寫的樣式。style height 100px color red background color aqua 123p 在head下寫 ch...

css的引入方式

style head html href css的url rel stylesheet type text css head html head style font size 24px color red hellodiv 字型24px,顏色紅色 body html type text css i...

CSS 的引入方式

行內樣式,行間樣式 是通過style屬性來設定元素的樣式 標籤名 style 屬性1 屬性值1 屬性2 屬性2 屬性3 屬性3 lang en charset utf 8 head style color red font size 16px type text value 南韓思密達 style ...