• 技术文章 >web前端 >html教程

    如何使用text-decoration

    php中世界最好的语言php中世界最好的语言2018-05-30 11:49:00原创3345
    我们在网页里常常会使用使用CSS代码来对象文字内容加上下划线。那么我们就要用到text-decoration了 ,如何使用呢?今天我们给大家好好介绍一下。

    使用CSS属性单词:

    text-decoration : none || underline || blink || overline || line-through

    text-decoration下划线CSS单词值参数:

    none :  无装饰

    blink :  闪烁

    underline :  下划线

    line-through :  贯穿线

    overline :  上划线

    text-decoration:none 无装饰,通常对html下划线标签去掉下划线样式

    text-decoration:underline 下划线样式

    text-decoration:line-through 删除线样式-贯穿线样式

    text-decoration:overline 上划线样式

    HTML常规下划线标签

    在HTML u标签下划线标签“U”即可对对象文字加html下划线。

    实例:

    <u>我被U标签加下滑线</u>

    CSS控制对象下划线属性样式

    html u下划线与CSS下划线对比应用案例

    CSS去掉html标签划线样式

    如果我们想去掉对应html中删除线s标签删除线样式、去掉html u下划线、去掉html上划线样式。

    1、去掉html s删除线贯穿线样式

    .p s{text-decoration:none}

    去掉p类对象盒子里html s标签样式属性

    2、去掉html u下划线样式

    .p u{text-decoration:none}

    去掉p类对象盒子里u标签下划线线样式属性

    五、超链接下划线高级运用 - TOP

    我们接下来为大家讲解常见CSS 超链接,当随便经过时候文字对象被加下划线。

    代码如下:

     <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
     "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> 
    <html xmlns="http://www.w3.org/1999/xhtml"> 
    <head> 
    <meta http-equiv="Content-Type" content="text/html;
     charset=utf-8" /> 
    <title>下划线演示</title> 
    <style> 
    .yangshi a{ text-decoration:none;}
    /* css注释: 鼠标经过热点文字被加下划线 */ 
    .yangshi a:hover{ text-decoration:underline;}
    /* 鼠标经过热点文字被加下划线 */ 
    </style> 
    </head> 
    <body> 
    <p> 
    <span class="yangshi"> 
    <a href="http:/m.sbmmt.com">p</a> 
    </span> 
    </p> 
    </body> 
    </html>

    请将以上代码复制新建HTML即可查看该实例样式。

    我们进行对3个盒子对象分别设置对象内文字下划线、文字删除线样式、字体上划线样式。

    1、css代码片段:

    .p{text-decoration:underline}

    .p_1{text-decoration:line-through}

    .p_2{text-decoration:overline}

    2、html代码片段:

    <p class="p">我被加下划线</p>

    <p class="p_1">我被加贯穿删除线</p>

    <p class="p_2">我被加上划线</p>

    介绍了这么多相信大家已经掌握了text-decoration,有需要的朋友可以保存一下,也请大家持续关注本站的其他更新。

    相关阅读:

    html的注释有什么作用


    CSS里怎么清除浮动


    html中的label标签使用方法

    以上就是如何使用text-decoration的详细内容,更多请关注php中文网其它相关文章!

    声明:本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系admin@php.cn核实处理。
    上一篇:HTML里table标签的使用方法 下一篇:HTML5文字弹幕效果
    20期PHP线上班

    相关文章推荐

    • 【活动】充值PHP中文网VIP即送云服务器• bootstrap问题 高手在哪里?_html/css_WEB-ITnose• ajax简单小例子_基于xml的实现• <meta>标签_html/css_WEB-ITnose• 如何考评一名前端工程师?_html/css_WEB-ITnose• 浏览器得到地址栏的相关信息_html/css_WEB-ITnose
    1/1

    PHP中文网