HTML (Hypertext Markup Language) is the standard language used to create web pages.
HTML syntax is the set of rules that define how an HTML document should be written. In this blog, we will discuss the basics of HTML syntax.
HTML Documents
An HTML document is made up of a series of elements, which are enclosed in tags.
Tags are composed of angled brackets, like this: “<” and “>”
The opening tag denotes the start of an element, and the closing tag denotes the end of an element.
e.g. To create a paragraph, we use the “<p>” opening tag and “</p>” closing tag.
<html> <head> <title>Page Title</title> </head> <body> <h1>This is Heading.</h1> <p>This is a paragraph.</p> <body> </html>
In the above example, we start with the document type declaration, which tells the browser that this is an HTML element and that contains the entire HTML document.
The “<head>” element, which contains the page title and any other meta information that the browser needs to know about the page.
The “<body>” element, which contains the visible content of the page, such as text, images, and links.
HTML Tags
They define the structure and content of an HTML document. Here are some of the most commonly used HTML tags:
“<h1>” to “<h6>” – Headings of different levels, with “<h1>” being the largest and most important heading, and “<h6>” being the smallest and least important heading.
“<p>” – Paragraphs of text.
“<a>” – Hyperlinks to other web pages or files.
“<img>” – Images to be displayed on the page.
“<ul>” and “<ol>” – Unordered and ordered lists, respectively.
“<li>” – List items to be included in a list.
“<table>” – Tables to display data in rows and columns.“<form>” – Forms for user input.
HTML Attributes
HTML attributes provide additional information about an element.
e.g. To add an image to a web page, we use the “<img>” tag with the “src” attribute, which specifies the location of the image file.
<img src="image.jpg" alt="An example image">
Conclusion
In this blog, we have covered the basic syntax of HTML, including elements, tags, and attributes