Skip to content

Instantly share code, notes, and snippets.

@pchatterjee
Created March 6, 2023 19:54
Show Gist options
  • Select an option

  • Save pchatterjee/405f03b401d094f56ae12c1e5cd68ee4 to your computer and use it in GitHub Desktop.

Select an option

Save pchatterjee/405f03b401d094f56ae12c1e5cd68ee4 to your computer and use it in GitHub Desktop.
<!DOCTYPE html>
<html lang="en">
<head>
<title>HTML5 Form Example </title>
<style>
body {
margin: 20px auto;
font-family: Helvetica, sans-serif;
font-weight: 400;
font-size: 1.25rem;
margin-left: 12px;
}
form, p {
margin: 20px;
}
p.note {
font-size: 1rem;
color: red;
}
input {
border-radius: 5px;
border: 1px solid #ccc;
margin-left: 20px;
padding: 8px;
margin-bottom: 20px;
font-family: sans-serif;;
font-size: 16px;
width: 200px;
}
label {
font-family: sans-serif;
font-size: 16px;
width: 146px;
display: inline-block;
}
input[type=submit] {
background-color: #214252;
color: white;
width: 120px;
padding: 8px 20px;
font-size: 18px;
border: none;
border-radius: 4px;
cursor: pointer;
float: left;
margin-left: -4px;
}
input[type=submit]:hover {
background-color: #92817a;
}
</style>
<title>Simple Survey Form</title>
</head>
<body>
<h4>Simple Survey:</h4>
<form id="survey" action="survey.php" method="post">
<label for="sno">student no: </label>
<input type="text" id="sno" name="sno" placeholder="99999999" pattern="[0-9]{8}" required>
<br>
<label for="name">name: </label>
<input type="text" id="name" name="name" placeholder="Joe" minlength="2" maxlength="24" required>
<br>
<label for="name">email: </label>
<input type="email" id="email" name="email" placeholder="joe@email.com" required>
<br>
<label for="name">age: </label>
<input type="number" id="age" name="age" min="16" max="99" placeholder="20" required>
<br>
<label for="name">favourite website: </label>
<input type="url" id="website" name="website" placeholder="https://youtube.com" required=>
<br/>
<input type="submit" value="submit">
</form>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment