html reference guide

a comprehensive guide to HTML for building websites.



what is html.

HTML (HyperText Markup Language) is the standard markup language used to create web pages. it structures the content on the web and is a fundamental building block for web development.


basic structure of an HTML document.

spooky skeleton.


    <!DOCTYPE html>
    <html lang="en">
    <head>
      <meta charset="UTF-8">
      <meta name="viewport" content="width=device-width, initial-scale=1.0">
      <title>Page Title</title>
    </head>
    <body>
      <header>
        <h1>Page Heading</h1>
      </header>

      <main>
        <p>Page content goes here.</p>
      </main>

      <footer>
        <p>Footer content</p>
      </footer>
    </body>
    </html>
                    

how to create multiple pages.

to create multiple pages in HTML, you simply create separate HTML files for each page and link them together using anchor tags.


    <a href="page2.html">Go to Page 2</a>
                    

the href needs to hold the value of the path to the file you want as the target page. this is the path relative to the current html file. If you have pages nested in folders, this is an important fact to remember. In some cases you may need to '..' to navigate up a directory level.

one of the best ways to list all the pages of your site is through a nav bar. lucky for us, html has a built in nav element.


    <nav>
        <a href="index.html">Home</a>
        <a href="page2.html">Page 2</a>
    </nav>
                    

this is perfect for almost any site. it is important to use predefined elements such as nav, because search engines and ai tools can better understand the structure of your site.

classes and ids.

we are going to have a lot of elements on our pages, and sometimes we are going to want to change their styles or behavior individually. this is where classes and ids come into play. classes are reusable and can be applied to multiple elements, whereas ids are unique and should only be used for a single element on a page.