CSS样式 怎样才可以做到鼠标移动到字体下显示有下划线

html-css010

CSS样式 怎样才可以做到鼠标移动到字体下显示有下划线,第1张

1、打开html开发工具并创建一个html文件。

2、在html页面上找到<body>标记,键入<body>标记,并用<a>标记覆盖内容。

3、修改<a>标签的内容,将颜色设置为蓝色。

4、将鼠标设置为在<a>标签上滑动,字体下方将变为红色下划线:a:hover {color:red}。

用text-decoration设置

值  描述

none    默认。定义标准的文本。  

underline    定义文本下的一条线。  

overline    定义文本上的一条线。  

line-through    定义穿过文本下的一条线。  

blink    定义闪烁的文本。  

inherit    规定应该从父元素继承 text-decoration 属性的值。 

实例

设置 h1、h2、h3、h4 元素的文本修饰:

h1 {text-decoration:overline}

h2 {text-decoration:line-through}

h3 {text-decoration:underline}

h4 {text-decoration:blink}