SYP Start Your Path

Elements & Attributes

HTML Elements

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

<tagname>Content goes here...</tagname>

Some elements are empty — they have no content and no closing tag, like <img> and <br>.

Elements can be nested inside each other:

<div>
  <h2>Welcome</h2>
  <p>Check out our <a href="/courses">course list</a>.</p>
</div>

When nesting, always close tags in the reverse order you opened them — this is called proper "nesting".

HTML Attributes

Attributes provide extra information about an element. They're always specified in the start tag, as name="value" pairs.

<a href="https://example.com">Visit Example</a>
<img src="logo.png" alt="Site logo">
<div id="main" class="container">...</div>

Attributes you'll see constantly:

Attribute values should always be wrapped in quotes — double quotes are the convention.