YouTip LogoYouTip

HTML Elements and Attributes

HTML Elements

An HTML element is defined by a start tag, content, and an end tag.

<tagname>Content goes here</tagname>

Nesting Elements

<div>
    <p>This is <strong>bold</strong> text.</p>
</div>

Block vs Inline

Block elements: div, p, h1-h6, ul, ol, table, form

Inline elements: span, a, strong, em, img, input

Attributes

<a href="#" target="_blank">Link</a>
<img src="photo.jpg" alt="Description" width="500">
<input type="text" id="name" class="form-control">

Summary

  • Elements are nested to create structure
  • Block elements start on a new line
  • Attributes provide additional information about elements
← HTML Forms and Input TypesHTML Tutorial - Complete Begin β†’