您现在的位置:首页 >> 前端 >> 内容

关于CSS文本装饰的实例讲解

时间:2018/2/21 11:31:49 点击:

  核心提示:文本装饰在CSS中,使用 text-decoration属性,可以在文本上方、下方、或中间添加装饰线,可选值为 none | underline | overline | line-through |...

文本装饰

CSS中,使用 text-decoration属性,可以在文本上方、下方、或中间添加装饰线,可选值为 none | underline | overline | line-through | blink,默认值为 none。none 无装饰,underline 下划线 ,overline 上划线,line-through 文字中间贯穿线,blink 闪烁。装饰线的颜色与文本的颜色相同。

默认情况下,文本都是没有装饰线的,但超链接是个例外,它默认就带有下划线。当然,可以把 text-decoration属性的值设置为 none,去掉超链接的下划线,当鼠标悬停后,再添加下划线,来提醒用户当前文本为链接文本。如:

a {

text-decoration: none;

}

a:hover {

text-decoration: underline;

}

文本装饰线的另一个常见用法,就是修订文本,在被删除文本上增加删除线。还有团购网站,在原价上增加删除线,做删除状。其实,还可以使用 text-decoration属性,为文本同时添加多条装饰线。如:

p {

text-decoration: underline overline line-through;

}

Tags:关于 于C CS SS 
作者:网络 来源:歪脖先生的博客