HTML Basic Examples

Here are some basic examples of HTML code:

Creating a heading

<h1>This is a level-1 heading</h1>
<h2>This is a level-2 heading</h2>
<h3>This is a level-3 heading</h3>
<h4>This is a level-4 heading</h4>
<h5>This is a level-5 heading</h5>
<h6>This is a level-6 heading</h6>

Creating a paragraph

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

Creating a link

<a href="http://www.example.com">This is a link</a>

Creating an image

<img src="image.jpg" alt="image">

Creating an unordered list

<ul>
  <li>Item 1</li>
  <li>Item 2</li>
  <li>Item 3</li>
</ul>

Creating an ordered list

<ol>
  <li>Coffee</li>
  <li>Tea</li>
  <li>Milk</li>
</ol>

Creating a table

<table>
  <tr>
    <th>Column 1</th>
    <th>Column 2</th>
  </tr>
  <tr>
    <td>Row 1, Column 1</td>
    <td>Row 1, Column 2</td>
  </tr>
  <tr>
    <td>Row 2, Column 1</td>
    <td>Row 2, Column 2</td>
  </tr>
</table>

Creating a form

<form action="process.php" method="post">
  <label for="name">Name:</label><br>
  <input type="text" id="name" name="name"><br>
  <label for="email">Email:</label><br>
  <input type="email" id="email" name="email"><br><br>
  <input type="submit" value="Submit">
</form> 

These are just a few basic examples of HTML code. You can find more information about HTML elements and how to use them in the HTML documentation.

Leave a Comment