HTML Examples

Here are some examples of HTML code:

Example 1: Basic HTML structure

<!DOCTYPE html>
<html>
  <head>
    <title>My Webpage</title>
  </head>
  <body>
    <h1>Welcome to my webpage</h1>
    <p>This is a paragraph of text.</p>
  </body>
</html>

Example 2: Adding an image

<!DOCTYPE html>
<html>
  <head>
    <title>My Webpage</title>
  </head>
  <body>
    <h1>Welcome to my webpage</h1>
    <p>This is a paragraph of text.</p>
    <img src="image.jpg" alt="An image">
  </body>
</html>

Example 3: Creating a form

<!DOCTYPE html>
<html>
  <head>
    <title>My Form</title>
  </head>
  <body>
    <form>
      <label for="name">Name:</label>
      <input type="text" id="name" name="name"><br><br>
      <label for="email">Email:</label>
      <input type="email" id="email" name="email"><br><br>
      <label for="message">Message:</label><br>
      <textarea id="message" name="message" rows="4" cols="50"></textarea><br><br>
      <input type="submit" value="Submit">
    </form>
  </body>
</html>

Example 4: Adding links

<!DOCTYPE html>
<html>
  <head>
    <title>My Links</title>
  </head>
  <body>
    <h1>Welcome to my links page</h1>
    <p>Here are some useful links:</p>
    <ul>
      <li><a href="https://www.google.com/">Google</a></li>
      <li><a href="https://www.wikipedia.org/">Wikipedia</a></li>
      <li><a href="https://www.github.com/">GitHub</a></li>
    </ul>
  </body>
</html>

You may also like...

Popular Posts

Leave a Reply

Your email address will not be published. Required fields are marked *