html-tips-tricks/inputs/index.html

95 lines
3.2 KiB
HTML
Raw Normal View History

2020-08-13 07:33:48 +02:00
<!DOCTYPE html>
<html>
<head>
<meta charset='utf-8'>
<meta http-equiv='X-UA-Compatible' content='IE=edge'>
2020-08-13 09:26:24 +02:00
<title>HTML Tips and Tricks - Inputs</title>
2020-08-13 07:33:48 +02:00
<meta name='viewport' content='width=device-width, initial-scale=1'>
2020-08-14 05:44:20 +02:00
<link href="https://fonts.googleapis.com/css2?family=Chilanka&display=swap" rel="stylesheet">
2020-08-13 07:33:48 +02:00
<link rel='stylesheet' type='text/css' media='screen' href='../main.css'>
2020-08-13 11:59:04 +02:00
<script>
function showColor(event) {
let colorHex = event.target.value;
document.getElementById('colorMe').style.color = colorHex;
}
</script>
2020-08-13 07:33:48 +02:00
</head>
<body>
<div class="demo">
2020-08-14 07:00:23 +02:00
<a href="../index.html" class="home">
<img src="../home.svg" alt="home" />
</a>
2020-08-13 07:33:48 +02:00
<h1>All about Inputs</h1>
2020-08-14 06:33:50 +02:00
<h2>Color picker</h2>
<input type="color" onchange="showColor(event)">
<p id="colorMe">Color Me!</p>
2020-08-13 07:33:48 +02:00
2020-08-14 06:33:50 +02:00
<div class="box">
<h2>Required</h2>
<form>
<label for="username1">Username:</label>
<input type="text" id="username1" name="username" required>
<input type="submit">
</form>
</div>
2020-08-13 07:33:48 +02:00
2020-08-14 06:33:50 +02:00
<div class="box">
<h2>Autofocus</h2>
<form>
<label for="username2">Username:</label>
<input type="text" id="username2" name="username" required autofocus>
<input type="submit">
</form>
</div>
2020-08-13 07:33:48 +02:00
2020-08-14 06:33:50 +02:00
<div class="box">
<h2>Placeholder</h2>
<form>
<label for="username3">Username:</label>
<input type="text" id="username3" name="username" placeholder="Enter your username">
<input type="submit">
</form>
</div>
2020-08-13 07:33:48 +02:00
2020-08-14 06:33:50 +02:00
<div class="box">
<h2>E-mail</h2>
<form>
<label for="email">Username:</label>
<input id="email" name="email" type="email" />
<input type="submit">
</form>
</div>
2020-08-13 11:59:04 +02:00
2024-10-11 12:51:52 +02:00
<div class="box">
<h2>Checkbox Languages Selection</h2>
<form>
<input type="checkbox" id="java" name="languages" value="Java">
<label for="java"> Java</label><br>
<input type="checkbox" id="javascript" name="languages" value="JavaScript">
<label for="javascript"> JavaScript</label><br>
<input type="checkbox" id="python" name="languages" value="Python">
<label for="python"> Python</label><br>
<input type="submit">
</form>
</div>
2020-08-14 06:33:50 +02:00
<div class="box">
<h2>Regex validations</h2>
<form>
<label for="password">Strong password($Password1234):</label>
<input type="password"
name="password"
id="password"
placeholder="6-20 chars, at least 1 digit, 1 uppercase and one lowercase letter"
pattern="^(?=.*\d)(?=.*[a-z])(?=.*[A-Z]).{6,20}$" autofocus required>
<button type="submit"> Test </button>
</form>
</div>
2020-08-13 07:33:48 +02:00
</div>
</body>
</html>