DEV Community

Cover image for HTML for Absolute Beginners
Chris Ebube Roland
Chris Ebube Roland

Posted on

HTML for Absolute Beginners

Introduction.

HTML, or HyperText Markup Language, is the foundation of the modern web. It is a simple and intuitive language that allows developers to create and structure content for the internet. If you are new to web development, HTML is a great place to start as it is easy to learn and forms the basis for more advanced technologies like CSS and JavaScript.
One of the main benefits of HTML is its versatility. It can be used to create static websites or be paired with more advanced technologies to create dynamic and interactive web applications. HTML is also an essential part of the stack for many web developers, as it is used to structure and present content for the web.

History of HTML.

HTML has a rich history that dates back to the early days of the internet. It was created in 1990 by Tim Berners-Lee, a British computer scientist who is credited with inventing the World Wide Web. At the time, Berners-Lee was working at CERN, the European Organization for Nuclear Research, where he developed a system for sharing research documents and information electronically.
Initially, Berners-Lee used a system called SGML (Standard Generalized Markup Language) to mark up the documents, but he quickly realized that this was too complex for the average user. He then developed a simplified version of SGML called HTML, which made it easier for people to create and share documents on the internet. The first version of HTML was written by Tim Berners-Lee in 1993. Since then, there have been many different versions of HTML. The most widely used version throughout the 2000's was HTML 4.01, which became an official standard in December 1999.
Since its inception, HTML has undergone numerous updates and changes. The most recent version, HTML5, was released in 2014 and includes new features and improvements that make it easier to create modern, interactive web applications.

How to get started.

Getting started with HTML is easy and straightforward. All you need is a text editor and a web browser. There are many text editors available, such as Notepad, Sublime Text, and Atom. These text editors allow you to write and edit your HTML code.
If you want to get started with HTML, the first thing you will need is a text editor. There are many options available, including free and open-source options like Notepad++ and Sublime Text, as well as paid options like Adobe Dreamweaver. You can use any text editor that you are comfortable with, as long as it allows you to create and edit plain text files.
Once you have a text editor installed, you can begin writing HTML code. To create an HTML document, you will need to start with a basic skeleton that includes the necessary tags and structure. The skeleton should look something like this:

<!DOCTYPE html>
<html>
<head>
  <title>My HTML Document</title>
</head>
<body>
  <!-- Add your content here -->
</body>
</html>
Enter fullscreen mode Exit fullscreen mode

The <!DOCTYPE html> declaration at the top tells the browser that the document is an HTML5 document. The element encloses the entire document, and the

element contains information about the document, such as the title and any linked stylesheets or scripts. The element contains the actual content of the document.

Tags and attributes.

HTML is made up of tags and attributes. Tags are used to mark the start and end of an HTML element, and attributes provide additional information about the element. Some common HTML tags include the <p> tag for paragraphs, the <h1> tag for headings, and the <div> tag for divisions. Some essential HTML attributes include the id attribute, which allows you to identify an element, and the class attribute, which allows you to apply styles to multiple elements at once.
HTML tags are used to mark the start and end of an HTML element. They are enclosed in angle brackets, and most tags come in pairs with a starting and closing tag. For example, the paragraph tag is written as <p> and </p>, with the content of the paragraph being placed in between the two tags.
HTML attributes provide additional information about an HTML element. They are added to the opening tag of an element and are used to modify the behavior or appearance of that element. For example, the href attribute is used to specify a link in the anchor tag, like this: <a href="https://www.example.com">Link</a>.

Meaning and listings of essential semantic tags and attributes.
There are many different HTML tags and attributes, but some of the most essential ones for beginners are:

  • The <html> tag, which defines the beginning and end of an HTML document.
  • The <head> and <body> tags, which divide the HTML document into the head (where metadata is placed) and the body (where the content of the webpage is placed).
  • The <title> tag, which specifies the title of the webpage.
  • The <h1> through
    tags, which are used to create headings.
  • The <p> tag, which is used to create a paragraph. -The <div> tag, which is used to create a division or section of the webpage. -The <img> tag, which is used to insert an image into the webpage.
  • The <a> tag, which is used to create a link.
  • The <ul> and <li> tags, which are used to create an unordered list.
  • The <ol> and <li> tags, which are used to create an ordered list.
  • The <table> tag, which is used to create a table.
  • The <form> tag, which is used to create a form for user input.

Do’s and Don’ts.

When working with HTML, there are a few do's and don'ts to keep in mind. One important thing to remember is to always close your tags. This means that every opening tag should have a corresponding closing tag. It is also important to use semantic tags, which provide meaning and context to your content. For example, instead of using a

tag to create a heading, you should use an <h1> tag.

Here are a few things to keep in mind when creating an HTML webpage:

  • Make sure to use semantic tags whenever possible. Semantic tags are tags that have a specific meaning, such as the <p> tag for paragraphs or the <h1> tag for headings. Using these tags helps to make the HTML more readable and easier to understand.
  • Use lowercase for all HTML tags and attributes. HTML is case-insensitive, but using lowercase makes the code more consistent and easier to read.
  • Use quotation marks for attribute values. For example, the src attribute of the <img> tag should be written as src="image.jpg" rather than src=image.jpg.
  • Don't forget to close your tags. Every opening tag should have a corresponding closing tag, unless it's a self-closing tag like the <img> tag. -Don't use too many nested tags. While it's okay to nest tags occasionally, it's important to keep the HTML structure as simple and flat as possible to avoid making it difficult to read and maintain.

Creating your first Html.

Now that you know the basics, it's time to create your first HTML page. The skeleton of an HTML page consists of a few essential elements, including the <head> element, which contains metadata about the page, and the <body> element, which contains the content of the page.
To create your first HTML page, open your text editor and create a new file. Then, type the following code:

<!DOCTYPE html>
<html>
  <head>
    <title>My First HTML Page</title>
  </head>
  <body>
    <h1>Welcome to My First HTML Page</h1>
    <p>This is my first attempt at creating an HTML page. I hope you enjoy it!</p>
  </body>
</html>

Result;

Image description

Save the file as index.html and open it in your web browser. You should see the heading and paragraph that you created.
Let's break down the different parts of this HTML page:

  • The <!DOCTYPE html> declaration tells the web browser that this is an HTML page.
  • The <html> element is the root element of an HTML page. It contains all the other HTML elements.
  • The <head> element contains metadata about the page, such as the page title and any external resources (e.g. stylesheets or scripts).
  • The <title> element specifies the title of the page, which is displayed in the browser's title bar or tab. -The <body> element contains the content of the page, such as headings, paragraphs, and images. -The <h1> element is a heading element, and it represents the most important heading on the page. There are six heading levels in HTML, ranging from <h1> to <h6>. -The <p> element is a paragraph element, and it contains a block of text.

Project

To take your HTML skills to the next level, try creating a simple static website. This can be as simple as creating a few pages and linking them together using the <a> tag. You can also add images and formatting using HTML tags like <img> and <strong>.
Now that you have the basics of HTML down, let's create a more complete HTML project.
First, let's add a navigation menu to our page. We can do this using an unordered list (<ul>) with list items (<li>) for each menu item:

<nav>
  <ul>
    <li><a href="#">Home</a></li>
    <li><a href="#">About</a></li>
    <li><a href="#">Contact</a></li>
  </ul>
</nav>

Next, let's add a section for our main content. We can use a <div> element to divide the page into sections:
Copy code

<div id="main">
  <h2>Welcome to my website</h2>
  <p>This is a simple website created with HTML.</p>
</div>

Finally, let's add a footer to our page. We can use a <footer> element to contain our footer content:

<footer>
  <p>Copyright 2021</p>
</footer>

Our complete HTML page should now look something like this:

<!DOCTYPE html> 
<html> 
  <head>
   <title>My Website</title>
  </head> 
<body> 
  <nav>
    <ul>
        <li><a href="#">Home</a></li> 
        <li><a href="#">About</a></li>
        <li><a href="#">Contact</a></li>
      </ul>
  </nav> 
<div id="main"> 
   <h2>Welcome to my website</h2>
  <p>This is a simple website created with HTML.</p>
</div> 
<footer> 
<p>Copyright 2021</p> 
</footer> 
</body>
 </html>

Result;

Image description

This is just a basic example of how you can use HTML to create a simple website. You can use other HTML elements and attributes to add more content and styling to your website.
Now that you know the skills to create an HTML project, try adding a few more elements to your page.
Here are some ideas:

  • Add an image using the <img> element.
  • Create a list using the <ul> and <li> elements.
  • Add a link using the <a> element.

FAQs
Here are some common questions about HTML:

  • What is an HTML tag? An HTML tag is a piece of code used to specify an element on an HTML page. It is written in the format <tagname>content</tagname>, with the opening tag, content, and closing tag.
  • What is the difference between HTML and CSS? HTML is used to structure and format content on the web, while CSS is used to style that content. CSS stands for Cascading Style Sheets and is used to apply formatting such as colors, fonts, and layout to web pages.

Conclusion.

In this article that is aimed at beginners, we introduced the you to HTML and gave pointers on how to start and illustrated how to create your first HTML skeleton with code examples. We also built a simple project to help you get familiar with the HTML environment.
HTML is a fundamental building block of the internet and an essential skill for any aspiring web developer. By learning HTML, you'll be able to create structured and well-formatted content for the web. With a little practice and some creativity, you can create your own websites and web applications using HTML and other web.

Top comments (0)