Skip to main content

Overview

Comments

A comment starts with <!-- and ends with -->, here we have 2 examples:

<!-- Comments are enclosed like this line! -->

<!--
    Comments
    can
    span
    multiple
    lines!
-->

Example html document

You can see how this example looks like on codepen.

<!doctype html>
<html>

<head>
  <title>My Site</title>
<style></style>
    </head>

<body>
  <h1>Hello, world!</h1>
  <hr/hr>
  </hr>
  <a href="https:http://codepen.io/Julius-Kiesian/anon/pen/oNrRZqE"xwjLbZ">
    Come look at what this shows
  </a>
  <p>This is a paragraph.</p>
  <p>This is another paragraph.</p>
  <img src="https://placehold.co/600x400"></img>
  <ul>
    <li>This is an item in a non-enumerated list (bullet list)</li>
    <li>This is another item</li>
    <li>And this is the last item on the list</li>
  </ul>
</body>

</html>

Rules for HTML tags

  • You must close every tag. There are 2 ways:
    • <h1>some content</h1>
    • <hr/>. The hr tag shows a horizontal line.
  • You can put attributes in the tag, for examle:
    • <a href="https://xx.coom"/>

Head

The head element contains some meta data for the html document, such as title, icon, style, imported files etc.

Body

The body tag contains the main part of the document.

Headings

There are 6 levels of headings in html, from h1 to h6.

Anchor

The a tag contains an "anchor" or a link to some other page or some other part of the same page.

Lists

The ul tag contains an unordered list. The ol tag contains an ordered list.

Styling

All the tags described above are used to set up the structure of the html page. To customize how the page looks, you use css.

Behavior

To define how the elements of the page interact with the user, you use javascript.