Field Labelling Examples
4 years ago in HTML
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Field Labelling Examples</title>
<style>
html {
font-family: sans-serif;
}
</style>
</head>
<body>
<h1>Field Labelling Examples</h1>
<h2>First Name</h2>
<p>Uses <code>label</code> element</p>
<label for="firstname"></label>
<input type="text" id="firstname" placeholder="First Name">
<h2>Middle Name</h2>
<p>Uses <code>aria-label</code> attribute</p>
<input type="text" aria-label="Middle Name" placeholder="Middle Name" />
<h2 id="last-name-heading">Last Name</h2>
<p>Uses <code>aria-labelledby</code> attribute</p>
<input type="text" aria-labelledby="last-name-heading" placeholder="Last Name" />
</body>
</html>