在css中,可以使用text-decoration属性设置删除线,语法“text-decoration:line-through”。text-decoration属性设置元素文本修饰,值为line-through时,定义穿过文本下的一条线。

本教程操作环境:windows7系统、CSS3&&HTML5版、Dell G3电脑。
新建test.html页面,在test.html 页面body区域内,新建一个div,用来存放物品名。在div标签内新建span,用来存放物品价格。在test.html 页面body区域内新建style标签,在style标签里设置span标签内的价格为红色
Document
键盘:
200元
在浏览器里打开test.html,看一下目前的效果

立即学习“前端免费学习笔记(深入)”;
回到编辑器,在test的style标签内,给span设置text-decoration: line-through属性
再次打开test.html,会发现价格上被加了删除线。
![1618884051293318.png ]E_4HY~3E67Q55`K]YW`L8I.png](https://img.php.cn/upload/image/484/307/766/1618884051293318.png)
推荐学习:css视频教程










