新建test.html页面,在test.html 页面body区域内,新建一个div,用来存放物品名。在div标签内新建span,用来存放物品价格。在test.html 页面body区域内新建style标签,在style标签里设置span标签内的价格为红色

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <style>
        .price{
            color:red;
        }
    </style>
</head>
<body>
    <div>键盘:
        <span class="price">200元</span>
    </div>
</body>
</html>

在浏览器里打开test.html,看一下目前的效果

CSS如何设置删除线

回到编辑器,在test的style标签内,给span设置text-decoration: line-through属性

<style>
        .price{
            color:red;
            text-decoration: line-through;
        }
    </style>

再次打开test.html,会发现价格上被加了删除线。

css如何设置删除线

声明:本站所有文章,如无特殊说明或标注,均为本站原创发布。任何个人或组织,在未征得本站同意时,禁止复制、盗用、采集、发布本站内容到任何网站、书籍等各类媒体平台。如若本站内容侵犯了原著者的合法权益,可联系我们进行处理。