Example Navigation
Example 1: input and button element labeling
Best Practice Rating: Good
- The
input element with type="button" or type="submit" is labeled using the value attribute.
- The
input of type submit has the default label of "submit".
- The
input element with type="button" or type="submit" can also be labelled using the title attribute content.
- The content of a
button element is the label.
Example Start
Example End
HTML Source Code
<div class="button">
<input type="button" value="Press me" onclick='alert("You pressed me!")'/>
</div>
<div class="button">
<input type="submit" onclick='alert("You pressed me!")'/>
</div>
<div class="button">
<button onclick='alert("You pressed me!")'>Example Button</button>
</div>
CSS Source Code
<style type="text/css">
div.button {
margin: 0;
padding: 0;
margin-left: 20px;
margin-bottom: .5em;
font-size: 100%;
font-weight: bold;
}
</style>