HTML Basic Syntax

The basic syntax of HTML involves using a combination of tags, attributes, and content to define the structure and content of a web page. Here’s a breakdown of the different parts of an HTML element:

  • Tags: HTML tags are used to define different types of elements on the web page, such as headings, paragraphs, lists, tables, and more. Tags are enclosed in angle brackets, and most tags come in pairs: an opening tag and a closing tag. For example, the opening tag for a paragraph is <p>, and the closing tag is </p>.
  • Attributes: HTML attributes provide additional information about an element, such as its size, color, or alignment. Attributes are specified within the opening tag of an element, using the format attribute="value". For example, the href attribute in an anchor tag specifies the URL of the page to which the link should point: <a href="https://www.example.com">Example</a>.
  • Content: HTML content is the text, images, or other media that appears between the opening and closing tags of an element. For example, the content of a paragraph element might look like this: <p>This is some text in a paragraph.</p>

Here’s an example of a simple HTML document:

<!DOCTYPE html>
<html>
  <head>
    <title>My Page</title>
  </head>
  <body>
    <h1>Welcome to my page</h1>
    <p>This is some text in a paragraph.</p>
    <a href="https://www.example.com">Click here to visit Example.com</a>
  </body>
</html>

This document includes the following HTML elements:

  • <!DOCTYPE html>: This declaration specifies the version of HTML being used.
  • <html>: This tag indicates the start of the HTML document.
  • <head>: This tag contains metadata about the document, such as the page title.
  • <title>: This tag sets the title of the page, which appears in the browser’s title bar or tab.
  • </head>: This tag indicates the end of the head section.
  • <body>: This tag contains the visible content of the page.
  • <h1>: This tag creates a heading with the text “Welcome to my page”.
  • <p>: This tag creates a paragraph of text.
  • <a>: This tag creates a hyperlink, with the href attribute specifying the URL to which the link should point.
  • </body>: This tag indicates the end of the body section.
  • </html>: This tag indicates the end of the HTML document.
Wordpress Social Share Plugin powered by Ultimatelysocial
Wordpress Social Share Plugin powered by Ultimatelysocial