<h1>Heading</h1>
<p>Paragraph</p>
<ul>
<li>My list</li>
<li>has two items.</li>
</ul>CSS and JavaScript accessibility best practices
Runnable notebook: every JavaScript, HTML and CSS example on this page executes in a sandboxed local frame. Nothing leaves the browser.
h1 {
font-size: 5rem;
}
p,
li {
line-height: 1.5;
font-size: 1.6rem;
}<p>The water is <em>very hot</em>.</p>
<p>
Water droplets collecting on surfaces is called <strong>condensation</strong>.
</p>strong,
em {
color: #a60000;
}<p>
Web content is marked up using Hypertext Markup Language, or
<abbr>HTML</abbr>.
</p>abbr {
color: #a60000;
}<p>Visit the <a href="https://www.mozilla.org">Mozilla homepage</a>.</p>a {
color: red;
}
a:hover,
a:visited,
a:focus {
color: #a60000;
text-decoration: none;
}
a:active {
color: black;
background-color: #a60000;
}<div>
<label for="name">Enter your name</label>
<input type="text" id="name" name="name" />
</div><label for="name">Enter your name:</label>
<input type="text" name="name" id="name" />form.onsubmit = validate;
function validate(e) {
errorList.textContent = "";
for (const testItem of formItems) {
if (testItem.input.value === "") {
errorField.style.left = "360px";
createLink(testItem);
}
}
if (errorList.hasChildNodes()) {
e.preventDefault();
}
}function createLink(testItem) {
const listItem = document.createElement("li");
const anchor = document.createElement("a");
const name = testItem.input.name;
anchor.textContent = `${name} field is empty: fill in your ${name}.`;
anchor.href = `#${name}`;
listItem.appendChild(anchor);
errorList.appendChild(listItem);
}<div class="errors" role="alert" aria-relevant="all">
<ul></ul>
</div>imgThumb.onmouseover = showImg;
imgThumb.onmouseout = hideImg;
imgThumb.onfocus = showImg;
imgThumb.onblur = hideImg;