HTML Syntax

HTML or Hypertext Markup Language is the basic building block of the web that is used to create web pages and web applications. It is the backbone of any website. It is essential for the proper functioning of web pages.

An HTML document is a text file that generally contains the following things. They are:

  • The text of the page itself
  • HTML markup tags that tell the browser how to display the web page. It identifies page elements, structure, formatting, media, and hypertext links to other pages. An HTML tag surrounds the text and applies meaning to it. We write it between angle brackets < and >.
  • Attributes that provide extra information about the element, and we applied it within the start tag. An HTML attribute comprises two fields: name and value.

Basic HTML Syntax


A basic HTML syntax refers to a set of rules that regulate the structure, elements, and attributes of HTML code. The general syntax of HTML is as follows:

<tagname>content</tagname>

In the above syntax, the tag name (here, tagname) itself is enclosed in angle brackets (<>). HTML tags contain an opening and a closing tag surrounding the content they affect.

The opening tag “turns on” a feature (like heading, paragraph, bold, etc.) and the closing tag turns it off. A forward slash (/) indicates a closing tag in the above syntax. HTML tags define the structure and meaning of web content.

Let’s take some examples based on this HTML syntax.

1. <h1>Heading</h1>

2. <h2>Heading</h2>

3. <p>Paragraph</p>

Basic Syntax with Attribute


The general HTML syntax with an attribute is as:

<tagname attribute_name= " attribute_value">content</ tagname>

In the above syntax, an attribute provides additional information about the markup tags. It is usually defined as attribute_name = attribute_value pairs that follow the tag name separated by a white space.

Let’s take some examples based on this HTML syntax.

Example:

1. <h1 id = "topHeading">Understanding basic HTML syntax: A Comprehensive Guide</h1>

2. <a href = "http://www.google.com/" > Click here to visit Google’s Website.< /a >

In this tutorial, you have known about the basic HTML syntax with the help of examples. I hope that you will have understood the basic syntax. Stay tuned with the next tutorial where you will learn HTML elements.
Thanks for reading!!!

DEEPAK GUPTA

DEEPAK GUPTA

Deepak Gupta is the Founder of Scientech Easy, a Full Stack Developer, and a passionate coding educator with 8+ years of professional experience in Java, Python, web development, and core computer science subjects. With strong expertise in full-stack development, he provides hands-on training in programming languages and in-demand technologies at the Scientech Easy Institute, Dhanbad.

He regularly publishes in-depth tutorials, practical coding examples, and high-quality learning resources for both beginners and working professionals. Every article is carefully researched, technically reviewed, and regularly updated to ensure accuracy, clarity, and real-world relevance, helping learners build job-ready skills with confidence.