HTML is the World Wide Web’s core markup language. HTML, or Hypertext Markup Language, is the standard markup language used to create and design documents on the World Wide Web (WWW). It provides a standardized way to structure content on web pages by using a combination of tags and attributes to define the various elements and their properties.
Originally, HTML was primarily designed as a language for semantically describing scientific documents. Its general design, however, has enabled it to be adapted, over the subsequent years, to describe a number of other types of documents and even applications.
HTML provides a structure for web pages by using a system of tags and attributes to define the various elements of a document, such as headings, paragraphs, links, images, and more. HTML documents are interpreted by web browsers, which render the content visually for users to view and interact with on the web. HTML is a fundamental technology for web development and is typically used alongside Cascading Style Sheets (CSS) for styling and JavaScript for interactivity to create rich and dynamic web experiences.
Tag
A tag is a keyword enclosed in angle brackets (< >) that represents a specific element or action within an HTML document. Tags are used to define the structure and content of the document.
Example
<p>
The letter p is a tag.
Element
An element consists of a pair of tags, along with the content between them, that defines a particular component or entity within the HTML document. It includes both the opening tag (<tag>
) and the closing tag (</tag>
), as well as any content nested between them. The element can also be a self-closing tag, known as a void element. It doesn’t require a separate closing tag. e.g. <img />
. The syntax for self-closing tags includes a forward slash (/
) before the closing angle bracket (>
), as shown in the example: <img />
. This format indicates to the browser that the element is self-closing and does not have a separate closing tag.
Examples of self-closing/void elements
<img />
<br />
<input />
<hr />
Example of an element
<p>Paragraph element</p>
Attribute
An attribute provides additional information about an element or modifies its behavior. Attributes are added to the opening tag of an HTML element and consist of a name and a value, separated by an equal sign (=
) and enclosed in quotes.
Example of an element with a attribute
<a href="https://www.example.com">Click here</a>
The letter a
is a tag. <a>
is an element. href
is the attribute name, and "https://www.example.com"
is its value. href
attribute specifies the URL that the link <a>
should navigate to when clicked.