HTML <legend> alignAttribute

HTML legend 标签参考手册HTML <legend> Tag

Examples

Right-align the caption:

<form>
  <fieldset>
    <legend align="right">Personalia:</legend>
    Name: <input type="text" size="30"><br>
    Email: <input type="text" size="30"><br>
    Date of birth: <input type="text" size="10">
  </fieldset>
</form>

Try it Yourself »

Browser Support

Internet ExplorerFirefoxOperaGoogle ChromeSafari

Except for Opera, other major browsers support the "left" and "right" values of the align attribute. Almost no major browser supports the "bottom" value.


Definition and Usage

HTML5 does not support the <legend> align attribute. Use CSS instead.

In HTML 4.01, the align attribute of <legend> is deprecatedDeprecated。

The align attribute specifies the alignment of the caption in a fieldset.


Syntax

<legend align="left|right|top|bottom">

Attribute Values

Value Description
left Left-aligns the caption (default).
right Right-aligns the caption.
top Aligns the caption to the top.
bottom Aligns the caption to the bottom.


HTML legend 标签参考手册HTML <legend> Tag Other Extensions