CSS樣式的三種匯入方式

2022-09-19 17:06:15 字數 1554 閱讀 3693

css樣式有三種匯入方式

1:行內樣式表

直接在標籤的style屬性中書寫css樣式

doctype html

>

<

html

lang

="en"

>

<

head

>

<

meta

charset

="utf-8"

>

<

title

>title

title

>

head

>

<

body

>

<

h1 style

="color: red"

>hello world

h1>

body

>

html

>

2:內部樣式表

在標籤內的標籤內書寫css樣式

doctype html

>

<

html

lang

="en"

>

<

head

>

<

meta

charset

="utf-8"

>

<

title

>title

title

>

<

style

>

h1style

>

head

>

<

body

>

<

h1>hello world

h1>

body

>

html

>

3:外部樣式表

在外部檔案內書寫樣式,然後通過標籤內使用標籤來匯入外部css樣式檔案

html檔案

doctype html

>

<

html

lang

="en"

>

<

head

>

<

meta

charset

="utf-8"

>

<

title

>title

title

>

<

link

rel="stylesheet"

href

="css/style.css"

>

head

>

<

body

>

<

h1>hello world

h1>

body

>

html

>

css檔案

h1

css匯入的三種方式

我是乙個段落 鏈結式與匯入式的區別 1 標籤屬於xhtml,import是屬性css2.1 2 使用鏈結的css檔案先載入到網頁當中,再進行編譯顯示 3 使用 import匯入的css檔案,客戶端顯示html結構,再把css檔案載入到網頁當中 4 import是屬於css2.1特有的,對於不相容cs...

匯入CSS的三種方式

style background red 第一種方式p charset gbk indextitle pstyle head 第二種方式p body html type屬性可以不寫 type text css rel stylesheet href css檔案路徑 type text css imp...

引入css樣式的三種方式

第一種 內部樣式表 charset utf 8 寒假練習title head style width 1000px height 1000px background color red font size 20px text align center 求索網工作室 body html 第二種 行間樣...