HTML Elements

In HTML, an element is a piece of content that is enclosed between a start tag and an end tag. Tags are the instructions you give to the browser on how to display content. An HTML element usually consists of:

  • Opening tag: It marks the start of an element. For example, <p> is the opening tag for a paragraph element.
  • Content: This is the text or media inside the element. For example, the words within a paragraph.
  • Closing tag: It marks the end of an element. For example, </p> is the closing tag for a paragraph element.

Example:

HTMLcopy
<p>This is a paragraph.</p>

Here, <p> is the opening tag, 'This is a paragraph.' is the content, and </p>is the closing tag.

More Examples of Elements

The <title> Element

The <title> element specifies the title of the webpage, which appears on the browser tab. It's crucial for SEO and user navigation.

HTMLcopy
<title>Introduction to HTML</title>

The <body> Element

The <body> element contains all the content that is visible to users, such as text, images, and links. Everything within the body tag is rendered on the webpage.

HTMLcopy
<body>
   <p>Welcome to my website!</p>
</body>

The <p> Element

The <p> element defines a paragraph. It's used for blocks of text, and browsers automatically add some space before and after each paragraph.

HTMLcopy
<p>This is a paragraph of text.</p>

In conclusion, HTML elements helps you structure your content in a way that's meaningful and accessible to users.

Page 6 of 33

Page 6 of 33

logoFALYTOM

Learn technologies like HTML, CSS, JavaScript, React, NodeJS and so much more. Practice your skills with our free games, examples, practice questions & quizzes

    © 2024 Tomilola Group
    • facebook logo
    • twitter logo
    • instagram logo
    • linkedin logo
    • github logo
    • youtube logo