【问题标题】:How to give border a title? [duplicate]如何给边框一个标题? [复制]
【发布时间】:2016-04-29 16:20:37
【问题描述】:

我想它真的很简单,但我找不到它,因为我不知道它是如何被调用的。 我想用标题做一个边框,像这样:

----TITLE_HERE----------------------------------

【问题讨论】:

标签: html twitter-bootstrap css


【解决方案1】:

您可以使用<fieldset><legend> 标签来实现这一点,如下面的代码所示,来自this answer

<div id="form" style="width:350px;">
    <fieldset>
        <legend style="color:blue;font-weight:bold;">General Information</legend>
        <table>
            <tr>
                <td><span style="text-decoration:underline">C</span>hange Password To:</td>
                <td><input type="text"/></td>
            </tr>
            <tr>
                <td><span style="text-decoration:underline">C</span>onfirm Password:</td>
                <td><input type="text"/></td>
            </tr>
        </table>
    </fieldset>
</div>

【讨论】:

  • 是的,@Xufox 写在 cmets 上。谢谢:)
  • 没问题。希望代码示例能提供更多帮助。
【解决方案2】:

我认为你会这样做:

fieldset {
    border : none;
    border-top : 1px solid #000;
}
<fieldset>
    <legend>Title</legend>
    Here is some demo content
</fieldset>

另见this Fiddle

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2011-07-10
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2021-06-05
    相关资源
    最近更新 更多