HTML Elements

HTML Element
  • An HTML element is defined by a start tag, some content, and an end tag.
  • <tagname>Content...</tagname>
    <h1>This Heading tag</h1>
    <p>This paragraph tag</p>

  • The HTML element is everything from the start tag to the end tag.
Start tag Element content End tag
<h1> My First Heading </h1>
<p> My first paragraph. </p>
<br> none none
Nested HTML Elements
  • HTML elements can be nested, All HTML documents consist of nested HTML elements.
  • Example of nested elements
<!DOCTYPE html>
<html>
<head>
<title>Example | title of HTML page</title>
</head>
<body>
<h1>This is Heading tag</h1>
<p>This is paragraph tag</p>
</body>
</html>
Never Skip the End Tag
  • Some HTML elements will display correctly, even if you forget the end tag.
<!DOCTYPE html>
<html>
<head>
<title>Example | title of HTML page</title>
</head>
<body>
<h1>This is Heading tag
<p>This is paragraph tag
</body>
</html>
HTML Links
  • HTML links are defined with the <a> tag.
  • <a href="https://phpcoderspoint.com"> Go to website </a>

  • The link's destination is specified in the href attribute. Attributes are used to provide additional information about HTML elements.
HTML Images
  • HTML images are defined with the <img> tag.
  • The source file src, alternative text (alt), width, and height are provided as attributes:

<img src="example.jpg" alt="image_description" width="151" height="151">

HTML Paragraphs
  • HTML paragraphs are defined with the <p> tag.

<p>This is a paragraph tag</p>