选择器 使用style标签属性可以为html标签添加样式,但是这种方式和html标签进行耦合,不便于后期维护代码是浏览器选择为哪些标签添加样式的标识符
<style>
/*标签选择器*/
div{letter-spacing: 12px;}
/*类选择器*/
.text-size{font-size: 36px;}
/*id选择器*/
#indent{text-indent: 43px;}
</style>
常用的css有
<style type="text/css">
a{text-decoration: none;}
#btn{
width: 298px;
height: 52px;
line-height: 52px;
font-size: 16px;
color: #ff6700;
text-align: center;
letter-spacing: 2px;
cursor: pointer;/*鼠标指针变化*/
border: 1px solid #ff6700;/*边框*/
background-color: white;
background-image: initial;
}
</style>
其中cursor:pointer是用于鼠标浮到方框改变鼠标状态的
有些css样式在行内中无效,添加display:block
在行内元素添加会使行内元素变为块级元素
在块级元素添加会使块级元素变为行内元素
<span style="display: block;">郑州</span>
<div style="display: inline;">高新区</div>
使用标签选择器设置body中的字体时
应在head中添加style并选择相应标签
在font中设置字体时应按照顺序设置
斜体、粗细、大小、字体形式
font: italic bold 36px "Brush Script mt";