开发者

HTML Align LEGEND Center

How do I adjust the legend width ? so I can center it on screen.

<fieldset>
<legend a开发者_StackOverflow中文版lign="center">LOGIN</legend>
</fieldset>


The legend element properties can be modified via CSS just like any other element. Here's an example of a legend with 100% width, centred text and yellow background: http://jsfiddle.net/Y7DnS/1/

HTML

<fieldset>
    <legend>LOGIN</legend>
    <input type="submit" value="OK" name="submit" />
</fieldset>

CSS

fieldset { border: 1px solid grey; padding: 10px; }
legend {
    background: yellow;
    width: 100%;
    text-align: center;
}


.simpleSolutionInCss{
    text-align: center;
    margin: auto;
}
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜