DEV Community πŸ‘©β€πŸ’»πŸ‘¨β€πŸ’»

FRANCIS NJOROGE MUTHONI
FRANCIS NJOROGE MUTHONI

Posted on

HTML Basics from a Newbie: Part 1

Learn the basics of Hyper Text Mark-Up Language from A Code Newbie


HTML Introduction

What is HTML?

  • HTML stands for Hyper Text Markup Language
  • HTML is the standard markup language for creating Web pages
  • HTML describes the structure of a Web page
  • HTML consists of a series of elements
  • HTML elements tell the browser how to display the content
  • HTML elements label pieces of content such as "this is a heading", "this is a paragraph", "this is a link", etc.

A Simple HTML Document Example

<!DOCTYPE html>
<html>
<head>
<title>Page Title</title>
</head>
<body>

<h1>My First Heading</h1>
<p>My first paragraph.</p>

</body>
</html>
Enter fullscreen mode Exit fullscreen mode

Example Explained

  1. The <!DOCTYPE html> declaration defines that this document is an HTML5 document
  2. The <html> element is the root element of an HTML page
  3. The <head> element contains meta information about the HTML page
  4. The <title> element specifies a title for the HTML page (which is shown in the browser's title bar or in the page's tab)
  5. The <body> element defines the document's body, and is a container for all the visible contents, such as headings, paragraphs, images, hyperlinks, tables, lists, etc.
  6. The <h1> element defines a large heading
  7. The <p> element defines a paragraph

What is an HTML Element?

An HTML element is defined by a start tag, some content, and an end tag:

  • <tagname>Content goes here...</tagname> The HTML element is everything from the start tag to the end tag:
<h1>My First Heading</h1>
<p>My first paragraph.</p>
Enter fullscreen mode Exit fullscreen mode

HTML Tags

HTML tags are like keywords which defines that how web browser will format and display the content. With the help of tags, a web browser can distinguish between an HTML content and a simple content. HTML tags contain three main parts: opening tag, content and closing tag. But some HTML tags are unclosed tags.

When a web browser reads an HTML document, browser reads it from top to bottom and left to right. HTML tags are used to create HTML documents and render their properties. Each HTML tags have different properties.

An HTML file must have some essential tags so that web browser can differentiate between a simple text and HTML text. You can use as many tags you want as per your code requirement.

  • All HTML tags must enclosed within < > these brackets.
  • Every tag in HTML perform different tasks.
  • If you have used an open tag <tag>, then you must use a close tag </tag> (except some tags) for example <br> & etc

Examples of tags to name a few

Start tag Element content End tag
<h1> My First Heading </h1>
<p> My first paragraph </p>
<br> none none

Happy Coding To My Fellow Newbies

"Coding Becomes easier when you understand how things works under the hood" - Frank the Code Newbie

Top comments (0)

DEV

Thank you.

Β 
Thanks for visiting DEV, we’ve worked really hard to cultivate this great community and would love to have you join us. If you’d like to create an account, you can sign up here.