HTML 001: HTML Elements

Neha
GigaGuardian
Published in
2 min readDec 21, 2022
ImageSource

HTML elements are the building blocks of HTML documents. They are defined using tags, which are used to interpret the structure and meaning of the content on a web page.

Examples of common HTML elements include the `<p>` tag for defining a paragraph, the `<img>` tag for inserting an image, and the `<h1>` tag for defining a first-level heading.

Here are some common HTML elements and their code:

  • `<p>`: Defines a paragraph of text.
<p>This is a paragraph of text.</p>
  • `<h1>` to `<h6>`: Defines headings of different levels.
<h1>This is a first-level heading</h1>
<h2>This is a second-level heading</h2>
<h3>This is a third-level heading</h3>
  • `<a>`: Defines a hyperlink, which allows users to navigate to a different web page or a different part of the same page.
<a href="http://www.example.com">This is a link</a>
  • `<img>`: Defines an image.
<img src="http://www.example.com/image.jpg" alt="This is an image">
  • `<div>`: Defines a section or division of the page that can be used to group other elements together.
<div>
<p>This is a paragraph inside a div.</p>
<p>This is another paragraph inside the same div.</p>
</div>
  • `<form>`: Defines a form that allows users to input data, which can then be submitted to a server for processing.
<form action="http://www.example.com/form-handler" method="post">
<label for="name">Name:</label>
<input type="text" id="name" name="name">
<input type="submit" value="Submit">
</form>
  • `<table>`: Defines a table for displaying tabular data.
<table>
<tr>
<th>Name</th>
<th>Address</th>
<th>Phone</th>
</tr>
<tr>
<td>John Doe</td>
<td>123 Main St.</td>
<td>555-1234</td>
</tr>
</table>
  • `<ul>`: Defines an unordered list, which is a list of items where the order of the items does not matter.
<ul>
<li>This is the first item in the list.</li>
<li>This is the second item in the list.</li>
<li>This is the third item in the list.</li>
</ul>

I hope you enjoyed this introduction to HTML Elements!

Follow me: LinkedIn, Twitter

--

--