【问题标题】:Horizontal html line underneath text [closed]文本下方的水平 html 行 [关闭]
【发布时间】:2015-11-01 18:38:23
【问题描述】:

我想在html 中画一条水平线,位于单词下方。像这样:

例子
¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯ ¯¯¯¯¯¯¯

我该怎么做?

【问题讨论】:

  • 您能给我们提供一个更具体的例子吗?你正在使用什么样的元素(divs/spans/etc)。你在找什么样的线路?您有什么要求?

标签: html text line


【解决方案1】:

听起来您只是要求在标题下方放置一条水平线。如果是这样,请使用 <hr> 元素。

示例:

<h1>This is a heading</h1><hr>

【讨论】:

    【解决方案2】:

    您可以使用文本装饰。

    p.sometext {
        text-decoration:underline;
    }
    

    或者你可以试试这个边框。

    div.sometext {
        border-bottom:solid 1px #DDD;
    }
    

    【讨论】:

    • 使用text-decoration&lt;u&gt; 元素相同,因此代码是错误的。拥有border-bottom 是正确的。
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2017-11-14
    • 2021-10-11
    • 2021-11-11
    • 1970-01-01
    • 2021-08-19
    • 2011-02-15
    相关资源
    最近更新 更多