css三種引用方式

1 直接在標籤內添加 style屬性css

1 <body>
2     <!-- 內嵌寫在標籤內 -->
3     <div style="color: red;font-size: 20px">山無陵,天地合</div>
4 </body>

運行效果:html

2 寫在標籤<head>中,內部樣式spa

 1 <html lang="en">
 2 <head>
 3     <meta charset="UTF-8">
 4     <title>css三種引用方式</title>
 5     <style type="text/css">
 6     /*寫在head標籤內,設置全部標籤爲div的樣式*/
 7  div{
 8  color:blue; font-size: 50px;
 9     }
10 
11     </style>
12 </head>
13 <body>
14     
15     <div ">山無陵,天地合</div>
16 </body>
17 </html>

運行效果:code

3 寫在<head>標籤內,引入一個css文件htm

1 <head>
2     <meta charset="UTF-8">
3     <title>css三種引用方式</title>
4     <link rel="stylesheet" type="text/css" href="URL">
5     </style>
6 </head>

運行效果:blog

相同,href內加入外部css文件的地址it

相關文章
相關標籤/搜索