最近在练习html语句的时候遇到了很多需要修改默认样式的地方,整理在此,方便以后使用。
a标签部分
/* none : 无装饰 blink : 闪烁 underline : 下划线 line-through : 贯穿线 overline : 上划线 */ /*设置a标签的下划线*/ a { text_decoration: none; } /*设置未被访问的a标签的下划线*/ a:link { text_decoration: none; } /*设置已经被访问过的a标签的下划线*/ a:visited { text_decoration: none; } /*设置鼠标悬停时的a标签的下划线*/ a:hover { text_decoration: none; } /*设置正在点击的a标签的下划线(鼠标按下,尚未松开)*/ a:active { text_decoration: none; } /*设置获得焦点的a标签的下划线(被鼠标点击过)*/ a:focus { text_decoration: none; }
文本css的样式
/*color 设置文字和颜色*/ div{ color:"red"; } /*font-size 设置文字的大小*/ div{ font-size: 20px; } /*font-family 设置文字的字体*/ div{ font-family:"微软雅黑"; } /*font-style 设置字体是否倾斜*/ font-style:’normal’;设置不倾斜,font-style:’italic’;设置文字倾斜 div{ font-style:"normal"; //不倾斜 font-style:"italic"; //倾斜 } /*font-weight设置文字是否加粗*/ div{ font-weight:bold;//加粗 font-weight:normal;//不加粗 } /*line-height 设置文字的行高,设置行高相当于在每行文字的上下同时加间距*/ div{ line-height:24px; } font 同时设置文字的几个属性,写的顺序有兼容问题,建议按照如下顺序写: 1.font:是否加粗 字号/行高 字体; 如:font:mormal 12px/36px "微软雅黑"; 2.text-decoration 设置文字的下划线,如:text-decoration:none; 将文字下划线去掉 3.text-indent 设置文字首行缩进,如:text-indent:40px; 设置文字首行缩进40px一般一个中文是20px 4.text-align 设置文字水平对齐方式,如:text-align:center 设置文字水平居中
css设置html中部分标签的样式
最新推荐文章于 2022-10-11 16:41:24 发布