1.下划线
代码:
<!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>装饰文本</title>
<style>
div{
/* 下划线 */
text-decoration: underline;
}
</style>
</head>
<body>
<div>粉红色的回忆</div>
</body>
</html>
运行效果:
2.删除线
代码:
<!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>装饰文本</title>
<style>
div{
/* 删除线 */
text-decoration:line-through;
}
</style>
</head>
<body>
<div>粉红色的回忆</div>
</body>
</html>
运行效果:
3.上划线
代码:
<!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>装饰文本</title>
<style>
div{
/* 上划线 */
text-decoration:overline;
}
</style>
</head>
<body>
<div>粉红色的回忆</div>
</body>
</html>
运行效果:
4.把链接去掉下划线
代码:
<!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>装饰文本</title>
<style>
a{
text-decoration:none;
color:#333;
}
</style>
</head>
<body>
<a href="#">粉红色的回忆</a>
</body>
</html>
运行效果:
重点:添加和取消下划线