Reputation: 41
<form class="form-1">
<label for="username" class="label1"> Username:</label>
<input
type="text"
name="username"
placeholder="eg Herny Hart"
id="name-input"
required>
<label for="email" class="label2"> Enter your Email: </label>
<input
type="email"
name="email"
placeholder="[email protected]"
id="email-input"
required>
<label for="number">2fa Verification If required:</label>
<input
type="text"
name="number"
placeholder="239578"
id="2fa-input">
<label>
<div>
<input id="submit" type="submit" value="Login">
<input id="submit2" type="submit" value="Sign-up">
</div>
</form>
I don't know if it is ok to put a div container inside a HTML5 form container or is it wrong.
Am new to coding i need help to complete my animation project
Upvotes: 2
Views: 97
Reputation: 1
Yes, div
can a part in a form also. For example:
<html>
<head>
<title> div</title>
<style>
body{
background-color:lightgreen;
}
</style></em>
</head>
<body>
<form action="">
<div><label for=" abc">name
<input type="text" placeholder="Enter your name" value="">
</label></div>
</form>
</body>
Upvotes: -1
Reputation: 325
You can validate your HTML code by uploading it in W3C validator, keep the link, and it will be helpful for future, run every time if you are hesitating. https://validator.w3.org/#validate_by_upload
Upvotes: 1
Reputation: 45745
Use MDN for questions like this. For this case, see here, and find the "Permitted content" section:
Permitted content: Flow content, but not containing
<form>
elements.
If you then click "Flow content" and read through the list, you'll see that div
is listed as "Flow content":
. . .
<dfn>
<div>
<dl>
. . .
So yes, div
s are allowed inside of form
s.
Upvotes: 4