在CSS+DIV中如何做到将价格划掉的效果

html-css016

在CSS+DIV中如何做到将价格划掉的效果,第1张

1 用到的知识点是html中 tex-decoration 属性;text-decoration的属性包括 : {text-decoration:overline}

{text-decoration:line-through}

{text-decoration:underline}

{text-decoration:blink}

将价格划掉的效果  用到的是line-through值。

2 下面是tex-decoration  的使用案例,代码可以直接复制到浏览器上面进行运行。

<html>

<head>

<style type="text/css">

h2 {text-decoration: line-through}

</style>

</head>

<body>

<h2>20元</h1>

</body>

</html>

3 下面是案例在浏览器上运行的效果图  :

<style type="text/css">

body {

font-size:18px

}

small {font-size:14px}

-->

</style>

<body>

99<small>.23</small>

</body>

css中的auto是自动适应的意思,而在css中auto往往都是默认值。\x0d\x0a\x0d\x0a正如margin:0 auto,意思就是上下边距为0,左右边距为auto,就是自动适应。\x0d\x0a但是,如果要使用他的话,就必须给标签配上指定的宽度,如下:\x0d\x0a居中\x0d\x0a\x0d\x0a.center{\x0d\x0awidth:200px\x0d\x0a\x0d\x0aheight:200px\x0d\x0a\x0d\x0amargin:0 auto\x0d\x0a\x0d\x0abackground-color:yellow\x0d\x0a\x0d\x0a}\x0d\x0a\x0d\x0a\x0d\x0a另外,margin:0 auto 和 margin: 0 auto 0 auto 的效果是相同的。\x0d\x0a都是指的上下边距为0,左右边距自动适应宽度相等。 回答于 2022-11-16