software-development-lessons

HTML

This lesson goes over HTML: why and how we use it

Slides

Topics

Story

HTML (HyperText Markup Language)

HTML Syntax

<a href="https://www.wikipedia.org">
  Go to Wikipedia
</a>

Elements can have more than one attribute.

<a href="https://www.wikipedia.org" target="_blank">
  Go to Wikipedia
</a>

Elements can contain other elements.

<!-- parent -->
<a href="https://www.wikipedia.org" target="_blank">
  <!-- child -->
  <img src="/wikipedia.jpg" alt="Go to Wikipedia">
</a>
  1. In that case, the one inside is known as a child element and the one outside is the parent element.

  2. If there are multiple levels of nesting, then all the elements inside an outer element are its descendants.

Attributes

Most attributes only make sense on specific elements.

  1. href="" is for <a> elements, to specify where to take the user when they click the link.
  2. src="" is for <img> elements, to specify the url of the image to load.
  3. for="" is for <label> elements, to specify which input element it is paired with.

HTML Boilerplate

<!DOCTYPE html>
<html>
  <head>
    <!-- where we tell the browser how to process the document: -->
        <!-- what title to put in the browser tab -->
        <!-- what style sheets to load -->
        <!-- what language to use -->
          <!-- we will always use a character set called UTF-8 -->
          <!-- UTF-8 allows for all languages as well as things like emoji -->
  </head>
  <body>
    <!-- content displayed to user -->
  </body>
</html>

Replit

Forms

Resources

Mozilla Developer Network, MDN

DevDocs

Next Up

CSS