Author: CYL
Date: 2020-10-11
Label form form box
Question: The existing HTML code is
<form action="form_action.asp" method="get">
<p>First name: <input type="text" name="fname" /></p>
<p>Last name: <input type="text" name="lname" /></p>
<input type="submit" value="Submit" />
</form>
The corresponding picture is,
but now I want to add an outer border to the form, it
becomes the following picture,
then change the code to:
<form action="form_action.asp" method="get">
<fieldset> <!--加外边框-->
<p>First name: <input type="text" name="fname" /></p>
<p>Last name: <input type="text" name="lname" /></p>
<input type="submit" value="Submit" />
</fieldset>
</form>
If you want to add a name to the outer border
, just add a label in the middle
<form action="form_action.asp" method="get">
<fieldset> <!--加外边框-->
<legend>注册表单</legend>
<p>First name: <input type="text" name="fname" /></p>
<p>Last name: <input type="text" name="lname" /></p>
<input type="submit" value="Submit" />
</fieldset>
</form>