I often see invalid HTML and cry. I encourage you to read the HTML Spec if you’re curious about valid HTML.

Nested Elements

The unordered list element, <ul>, can only contain zero or more <li>, <script> and <template> elements. The <li> element can contain any element belonging to the flow content category. Some elements can only specific child elements. You’re encouraged to validate your HTML.

Alt Attribute

The alt attribute must be specified for every image tag. Here are the requirements for providing text to act as an alternative for images.

One way to think of alternative text is to think about how you would read the page containing the image to someone over the phone, without mentioning that there is an image present. Whatever you say instead of the image is typically a good start for writing the alternative text.

HTML Example

Below is an example of some valid HTML.

<!doctype html>
<html lang="en">
  <meta charset="utf-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>My Webpage</title>
  <h1>Welcome to my webpage</h1>