怎么让css的属性加中划线

html-css010

怎么让css的属性加中划线,第1张

需要准备的材料分别有:电脑、浏览器、html编辑器。

1、首先,打开html编辑器,新建html文件,例如:index.html。

2、在index.html中的<style>标签中,输入css代码:body{text-decoration: line-through}。

3、浏览器运行index.html页面,此时用css成功让文本添加了中划线。

css去掉下划线只要我们把text-decoration属性改成none就可以了。

并不是很难,在HTML中,我们可以使用u标签来加下划线,但是在css中我们只能使用text-decoration属性,我们想把下划线设置成红色,只要我们保持和字体的颜色相同就可以了。在css中,我们可以使用text-decoration属性来表示下划线和删除线等样式,首先我们要了解一下text-decoration属性。

text-decoration属性一共有五个值,分别是none,blink,underline,line-through,overline,其中underline就表示下划线。语法如下:

div{text-decoration:none}表示:一般去掉下划线

div{text-decoration:underline}表示一般添加下划线样式

div{text-decoration:line-through}一般表示贯穿线

div{text-decoration:overline}设置上划线样式