CSS:頁面美化和布局控制
- 概念:
- Cascading Style Sheets 層疊樣式表
- 層疊:
- 多個樣式可以作用在同一個html的元素上,同時生效
- 優點:
- 功能強大
- 將內容展示和樣式控制分離
- 降低耦合度,解耦,
- 讓分工協作更容易
- 提高開發效率
CSS的使用:CSS與html結合方式
行內樣式
- 在標簽內使用style屬性指定css代碼
- 如:
<div style="color:red;">hello css</div>內部樣式
- 在head標簽內,定義style標簽,style標簽的標簽體內容就是css代碼
- 如:
<style> div{ color:blue; } </style> <div>hello css</div>外部樣式
- 1. 定義css資源檔案,
- 2. 在head標簽內,定義link標簽,引入外部的資源檔案
- 如:
- a.css檔案:
div{ color:green; }
- b.html檔案:
<link rel="stylesheet" href="https://blog.csdn.net/baidu_41388533/article/details/css/a.css"> <div>hello css</div> <div>hello css</div>
- 注意:
- 1,2,3種方式 css作用范圍越來越大
- 1方式不常用,后期常用2,3
- 第3種格式可以寫為:
<style> @import "css/a.css"; </style>
- 【注】:參考黑馬CSS教程
轉載請註明出處,本文鏈接:https://www.uj5u.com/houduan/2745.html
標籤:python
上一篇:Vue-cli可視化界面的bulid構建線上模式打包失敗:No module factory available for dependency type: CssDependency
