HTML <form> form plus border

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, Insert picture description here
but now I want to add an outer border to the form, it
becomes the following picture, Insert picture description here
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
Insert picture description here

	<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>

Note: There are too many tags to remember in HTML

Guess you like

Origin blog.csdn.net/cyl_csdn_1/article/details/109012310