Title

Update your webpage's title in the <head></head> of your HTML document (VS Code sets the title to "Document" by default).

<head>
  ...
  <title>Your Title Goes Here</title>
  ...
</head>

Favicon

A "favicon" is the small image that shows in the browser tab for a webpage.

A screenshot of Wikipedia showing the favicon next to the address bar.
Wikipedia

To add a favicon to your webpage, choose an image and save it as an .ico file type. Add the image to your project folder. Then, add the following link to the <head></head> of your HTML document, with the appropriate file path for your icon in the href:

<head>
  ...
  <link rel="icon" href="images/icon.ico"></link>
  ...
</head>

Accessibility

alt text

When you add an img to an HTML file, you should also write a brief description of the image for the alt text. This helps optimize your webpage for search engines (see SEO below), offers backup content in case images fail to load, and makes the webpage more accessible for vision-impaired users.

For example:

<img src="images/happyCow.png" alt="A photo of a cow smiling at the camera"></img>

Color blindness

Use online tools like this or this to see how your webpages will appear to someone who is color blind.

For example: if you want text on your webpage to be legible, make sure that the text color contrasts enough with the background behing it. Someone with red/green colorblindness may not be able to see red text on a green background.

Mobile responsiveness

If you want your webpage to be viewed on multiple devices, include the following meta tag in your HTML document's <head></head>:

<meta name="viewport" content="width=device-width, initial-scale=1.0">

You can also use some combination of CSS flexbox, @media queries, or tools like Bootstrap to control how your webpage reorients for different screen sizes.

For example: if you have a column layout on desktop, convert it to rows on mobile so content isn't cramped across a smaller screen width.

SEO

SEO stands for Search Engine Optimization, and refers to ways of increasing the likelihood that your webpage will appear in the results for relevant searh engine (Google, Ecosia, Bing, etc.) searches. Search engines parse the HTML of webpages for key words, looking in the title, header (h1 – h6) tags and the img alt text. You can also directly provide these key words by adding a description for your page (and naming yourself as the author, while you're at it).

Add the following meta tags in the <head></head> of you HTML document, filling in your own information as necessary. It is best practice to keep the description under 105 characters:

<head>
  ...
  <meta name="description" content="Tutorial for refining details of HTML webpages">
  <meta name="author" content="AnneMarie Torresen">   ...
</head>

Also, if you don't want your page to appear in search engine results, you can include the following in your HTML <head></head>:

<head>
  ...
  <meta name="robots" content="noindex">
  ...
</head>

Code Hygeine

comments

To add a code comment that will appear in your .html file but not on your webpage, surround text with <!-- and -->

<!-- this is a comment in HTML -->
<!-- use comments to keep track of what your code is doing -->

In a .css file, comments are indicated by /* and */

/* this is a comment in CSS */
/* well-commented code is easier to read */

Each coding language has its own syntax for indicating a comment. In VS Code, you can comment out a line of code using the Cmd+/ or Ctrl+/ keyboard shortcut.

whitespace

Even though it won't affect how your webpage renders, it is best practice to use consistent whitespace (spaces, tabs, and line breaks) throughout your code files.

For example, keep the opening and closing tags of an element at the same indentation level and indent tags nested inside others (this can help you avoid tag soup):

<table>
    <tr>  <!-- 1 tab in -->
        <td> <!-- 2 tabs in --> </td>
        <td> <!-- 2 tabs in --> </td>
    </tr>
    <tr>  <!-- 1 tab in -->
        <td> <!-- 2 tabs in --> </td>
        <td> <!-- 2 tabs in -->/span> </td>
    </tr>
</table>

Cleanly formatted code with plenty of comments is easier to read -- you will thank yourself in the long run.