Home Fun Games Blog CDCRIFD CDRD Utilities About

Creating your first page

First, I highly recommend getting a free account at Neocities (to get a website subdomain like mine, which is cerebraldatabank.neocities.org). Click here and click "Continue anyway".

If using Neocities (or another web host service), open index.html (or create another file, whatever you want). If not, create a new file called "my_first_page.html" locally on your computer, and open it with Notepad (for Windows, right-click it, hover over "Open with…", and click "Notepad").

All HTML documents should start with a DOCTYPE declaration, as shown below.

        <!DOCTYPE html>

The DOCTYPE declaration must be the first line of the HTML document.

Most HTML elements (also called nodes) have an opening and closing tag, as shown below.


The opening tag is <tag> and the closing tag is </tag> (note the slash preceding the tag name).

Directly after the DOCTYPE declaration there should be an <html> element, as shown below.

        <!DOCTYPE html>

An HTML document is made up of two main parts, the head and the body (explained later). So let's add elements for those:

        <!DOCTYPE html>

The content of the <head> element is information about the page that is ususally not visible to the user. The content of the <body> tag is what is displayed on the user's screen when they visit your website. Try editing the below code to see live results in the box next to it.

Markup Tags

The tag above is the <p> tag, which denotes a paragraph. There are many other tags, as shown below.

        <h1>1st-level heading</h1>
<h2>2nd-level heading</h2>
<h3>3rd-level heading</h3>
<h4>4th-level heading</h4>
<h5>5th-level heading</h5>
<h6>6th-level heading</h6>
<strong>Strong (bold) text</strong>
<em>Emphasized (italic) text</em>
<main>Main content of page</main>
<span>A piece of text that should be stylistically or otherwise different</span>
<br> <!--Line break-->
<hr> <!--Horizontal rule-->
<aside>Content that is aside from the main content but still related</aside>
<nav>Navigation menu</nav>
<article>Article content</article>
<section>Section (e.g. a section of an article with its own subheading)</section>
<pre>Preformatted text (line breaks, spaces, etc. are preserved)</pre>
<sup>Superscript text</sup>
<sub>Subscript text</sub>
<del>Deleted (strikethrough) text</del>
<ins>Inserted (underlined) text</ins>
<samp>Sample output from a computer program</samp>
<b>Bold text</b>
<i>Italic text</i>
<u>Underlined text</u>

The HTML for a basic article might be:

        <!DOCTYPE html>
    <title>My Article - My Website</title>
        <h1>My Article</h1>
        <h2>My 1<sup>st</sup> Section</h2>
        <p>The content of my first section.</p>
        <h2>My 2<sup>nd</sup> Section</h2>
        <p>The content of my second section.</p>
      <h2>You Might Like:</h2>
      <p>Related links.</p>

HTML entities are used to encode special characters. Notice how, outside of <pre> elements, HTML automatically downsizes all consecutive spaces? So <p>Welcome...     to my website!!!<p> becomes "Welcome... to my website!".

An HTML entity can have the following syntax:

        &entityname; /*Only some HTML entities have entity names.*/

For example, the TM (trademark) sign (™) could be either of the following:

        &trade; (displays as ™ in your browser)
&#x2122; (displays as ™ in your browser)
&#8482; (displays as ™ in your browser)

Therefore, to prevent the space downsizing, we will replace each of the spaces with a non-breaking space (NBSP). So this:

        <p>Welcome...     to my website!!!<p>

will turn into this:

        <p>Welcome...&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;to my website!!!<p>
Continue →