Title
Update your webpage's title in the <head></head> of your HTML document (VS Code sets the title to "Document" by default).
...
<title>Your Title Goes Here</title>
...
</head>
Update your webpage's title in the <head></head> of your HTML document (VS Code sets the title to "Document" by default).
A "favicon" is the small image that shows in the browser tab for a webpage.
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:
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:
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.
If you want your webpage to be viewed on multiple devices, include the following meta tag in your HTML document's <head></head>:
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 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:
Also, if you don't want your page to appear in search engine results, you can include the following in your HTML <head></head>:
To add a code comment that will appear in your .html file but not on your webpage, surround text with <!-- and -->
In a .css file, comments are indicated by /* and */
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.
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):
Cleanly formatted code with plenty of comments is easier to read -- you will thank yourself in the long run.
<!-- use comments to keep track of what your code is doing -->