一、基础设置
1、基础属性
div{
font-size: 35px; /* 改变字体大小 */
font-family: "微软雅黑"; /* 改变字体 */
font-weight: bold; /* 改变字体粗细,400px正常,700粗体 */
font-style: italic; /* 斜体字 */
text-decoration: underline; /* 下划线 */
text-decoration: none; /* 取消a标签下划线 */
line-height: 30px; /* 设置行间距,行高==容器高度可以让文字上下居中 */
/* 设置颜色方式 */
color:red;
color:#53a9ed;
color:rgb(246,246,246);
/* 开头缩进 */
text-indent:50px;
/* 设置对齐方式 */
text-align:center; /* 居中对齐 */
text-align:left; /* 靠左对齐 */
text-align:right; /* 靠右对齐 */
/* 设置间隔 */
letter-spacing:2px; /* 设置字符之间间隔 */
line-height:20px; /* 设置行高(行之间间隔) */
/* 设置文字阴影
text-shadow:2px 2px #FF0000; /* 位置1:设置阴影向右偏移,位置2:设置阴影向下偏移,位置3:设置阴影颜色 */
}
2、设置div根据字体数量自动适应调整
<div style="background-color: darkgrey;display: inline;">自动适应字体数量</div>