~wb: HTML tutorial, chapter 1

(1.1) What is HTML?

HTML, short for Hypertext Markup Language, is a written language used to describe webpages. Hypertext is text containing hyperlinks, and marking up a document is annotating it such that the annotations are syntactically distinguishable from its content. HTML documents mainly consist of plain text, and tags.

(1.2) Tags

Tags are pieces of text that the document is marked up with. Two common kinds of HTML tags are start tags and end tags. The simplest kind of start tag takes the following form: <tag-name>, and end tags take the form </tag-name>. An example of a tag name is h1, which is short for “header one”; here’s an example of an opening and closing tag, both with the tag name h1, surrounding the plain text “My website”: <h1>My website</h1>.

Start and end tags almost always must come in pairs, and each pair’s start and end tags must have the same tag name. Sequences of a start tag, valid HTML content, and a matching end tag are referred to as elements. Elements may fully contain other elements, but their starts and ends may not overlap (e.g. <article><h1>Hello, world.</article></h1> is invalid; the problem here is that the h1 element starts inside of another element, but ends outside of it.)

Void tags, another kind of tag, are like start tags, except they contain nothing and have no corresponding end tag. Here’s an example of a void tag with the tag name br (short for line break): <br>.

Note: a tag name is only valid if it’s described in the HTML specification, or has been defined with JS.

(1.3) Attributes

Start and void tags may have attributes, which take the form name=value and come right after the tag name. Here’s an example of a void tag with a src attribute: <img src=/neocities.png>. If an attribute’s value contains spaces, put double quotation marks around the value (e.g. title="hewwo there!".) If an attribute’s value contains double quotation marks, put a backslash (\) before every double quotation mark, then put double quotation marks around the value (e.g. title="Dwain \"The Rock\" Johnson").

(1.4) Anatomy of an HTML file

Here are the contents of a simple and valid HTML file:

<!DOCTYPE html>
<html lang=en>

<meta charset=UTF-8>
<title>My Website</title>

(1.5) Actually making a file

Follow these steps:

  1. Go to Neocities.
  2. Log in or sign up.
  3. Click Edit Site (it’s near the upper right hand corner.)
  4. Click New Folder.
  5. Name the folder “tutorial”.
  6. Hover over the new folder.
  7. Click on Manage.
  8. Click New File.
  9. Name the file “index.html”.
  10. Hover over the new file.
  11. Click Edit.
  12. Delete all the stuff.
  13. Copy the HTML in the Anatomy of an HTML file section and paste it into the editor.
  14. Click Save.

If you go to http://{YOUR SITE NAME HERE}.neocities.org/tutorial/, you should be greeted with an empty webpage.

(1.6) Adding stuff

This page is empty. Let’s change that. In the editor, add the following text on a new line after the title element: <img src=/neocities.png>. Click Save again. Reload your tutorial page. There should now be an image on the page.

To be continued…

Generated with dotcomboom’s AutoSite.

wastebinNeoCities.org: the web is yours