css的一些属性总结

常用属性

font-size:n px;
设置字体大小
font-weight:bold;
字体加粗(属性值:lighter/normal/bold/bolder或100-900)
*注:有的字体样式用不到bolder,所以bold之后没变化
font-style:italic;
设置斜体(normal 归正)
font-family:“宋体”;
字体样式
width: n px;
元素的宽
单位为px/%
height:n px;
元素的高
border: 1px solid black;
元素的边框,复合属性
拆分:
1.border-width:1 px;
边框的粗细为1px
2.border-style:solid;
边框为实体(其他值:dotted 点状虚线;dashed 条状虚线)
3.border-color:black;
边框颜色为黑色
4.四条边拆分
border-left/right/top/bottom: 1 px solid black;
还可以拆成:
border-left-color:red;等
border-radius: n%/px;
圆角设置
opacity:0.5;
透明度,值为0-1
**background-color: black;**等
背景颜色

color

三种格式
1.土鳖式:red、green、blue(用来测试,不能用于开发)
2.颜色代码:如#ff4400
分析:每两位代表一个颜色饱和度(00-ff,十六进制的数值)
注:两位相同时可以缩写,如#ff4400可缩写#f40;#ff4432就不能缩写
3.颜色函数:如rgb(255,255,255)值为0-25
4.透明色:transparent

文本属性

text-align:left;
文本对齐方式(right 右对齐;center 居中对齐)
line-height: n px;
单行文本所占高度
text-indent: 2 em;
首行缩进2空格
text-decoration:line-through;
文字样式:中划线(值:none;underline(下划线);overline(上划线))
cursor:pointer;
当鼠标移上去会变成小手(值:help问号 e-resize/w-resize拖拽符 copy move等)

发布了22 篇原创文章 · 获赞 33 · 访问量 1076

猜你喜欢

转载自blog.csdn.net/qq_42577542/article/details/103014419