一.CSS应用
CSS主要有三种方式应用到HTML上:
- 行内样式:<button style="...">搜索</button>
- 内嵌式:<head><style>...</style></head>
- 链接式:<link rel="stylesheet" href="home.css"/>样式写在 home.css 中
二.CSS选择器
标签选择器
<button>按钮</button>
button{
width:100px;
}
class 类名选择器
最常用的选择器
<button class="button">按钮</button>
.button{
width:100px;
}
id 选择器
id 全页面唯一
<button id="button">按钮</button>
#button{
width:100px;
}
后代选择器
父选择器 + 空格 +