2016-01-22 48 views
0

我想它很简单,但我无法找到它,因为我不知道它是如何调用的。 我想制作一个标题边框,如下所示:如何给边界一个标题?

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

+4

您可能正在寻找['

'和''](https://developer.mozilla.org/en/docs/Web/HTML/Element/fieldset)元素。 – Xufox

+0

是的!我忘了他们的名字。谢谢!我为这个愚蠢的问题感到抱歉... @Xufox –

+0

你希望我在没有你的代码的情况下猜测原因吗? – Xufox

回答

2

您可以使用<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>

+0

是的,@Xufox在评论中写道。谢谢:) –

+0

没问题。希望代码示例将提供更多帮助。 – Chase

0

我想你正在寻找类似的东西这样的:

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


参见this Fiddle