Web development tutorial A-2

Lesson Two: Learning HTML from Scratch - Advanced Tags and Tables

Website design

January 30, 2025

Web development tutorial A-2

Lesson Two: Learning HTML from Scratch - Advanced Tags and Tables

Welcome to the second lesson in the series "Learning HTML from Scratch to Mastery!" In this lesson, we will dive deeper into HTML and learn how to use advanced tags such as tables and forms. Additionally, we will introduce some basic styling using CSS.


1. Tables

Tables are used to display data in an organized manner with rows and columns. In HTML, we use the following tags to create tables:

  • <table>: Defines the beginning and end of the table.

  • <tr>: Defines a row in the table.

  • <th>: Defines a column header (Header Cell).

  • <td>: Defines a cell in the table (Data Cell).

Simple Table Example:

<table border="1">
    <tr>
        <th>Name</th>
        <th>Age</th>
        <th>Country</th>
    </tr>
    <tr>
        <td>Ahmed</td>
        <td>25</td>
        <td>Egypt</td>
    </tr>
    <tr>
        <td>Mohamed</td>
        <td>30</td>
        <td>Saudi Arabia</td>
    </tr>
</table>

Code Explanation:

  • border="1": Adds borders to the table (this can be removed or modified using CSS later).

  • <th>: Used for column headers.

  • <td>: Used for table data.


2. Forms

Forms are used to collect data from users, such as registration information or search queries. In HTML, we use the following tags to create forms:

  • <form>: Defines the beginning and end of the form.

  • <input>: Used for data input (text, email, password, etc.).

  • <label>: Links text to the input field.

  • <button>: Used to create buttons like a submit button.

Simple Registration Form Example:

<form action="/submit" method="post">
    <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="password">Password:</label>
    <input type="password" id="password" name="password"><br><br>
    
    <button type="submit">Register</button>
</form>

Code Explanation:

  • action="/submit": Specifies where the data will be sent.

  • method="post": Specifies the method of sending data.

  • <input type="text">: Used for text input.

  • <input type="email">: Used for email input.

  • <input type="password">: Used for password input.


3. Semantic Tags

Semantic tags are used to give meaning to the structure of a webpage, making it more readable for browsers and search engines. Some of these tags include:

  • <header>: Used for the page header.

  • <nav>: Used for the navigation section.

  • <section>: Used for a section of the page.

  • <article>: Used for independent content.

  • <footer>: Used for the page footer.

Example Using Semantic Tags:

<header>
    <h1>My Personal Website</h1>
    <nav>
        <a href="#about">About Me</a> |
        <a href="#contact">Contact Me</a>
    </nav>
</header>

<section id="about">
    <h2>About Me</h2>
    <p>I am a beginner web developer who loves learning new technologies.</p>
</section>

<footer>
    <p>All rights reserved &copy; 2023</p>
</footer>

 


4. Introduction to CSS

CSS (Cascading Style Sheets) is a language used to style HTML pages. CSS can be added to HTML in several ways:

  • Inline CSS:

<p style="color: blue; font-size: 20px;">This text is blue.</p>
  • Internal CSS:

<head>
    <style>
        p {
            color: blue;
            font-size: 20px;
        }
    </style>
</head>
  • External CSS:
<head>
    <link rel="stylesheet" href="styles.css">
</head>

Simple Text Styling Example

<head>
    <style>
        h1 {
            color: green;
            text-align: center;
        }
        p {
            color: red;
            font-size: 18px;
        }
    </style>
</head>
<body>
    <h1>Hello, World!</h1>
    <p>This text is styled using CSS.</p>
</body>

5. Practical Exercise

Try creating an HTML page that includes the following elements:

  1. A table showing your weekly schedule (days, activities).

  2. A simple registration form with fields for name, email, and password.

  3. Use semantic tags like <header> and <footer> to organize the page.

  4. Add simple styling using CSS to change text color and font size.


What’s Next?

In the next lesson, we will dive deeper into CSS and learn how to style pages professionally. We will cover topics such as colors, fonts, margins, and containers. Get ready for more fun and practical application!

📌 Tip: Don’t hesitate to experiment with the code and modify it to see the results. Practice is the key to mastery! 🚀

Comments

No Comments

There are no comments

Please login to leave a review

  • Web development tutorial A-0

    Web development tutorial A-0

    From Zero to Hero: A Complete Web Development Journey

    View article
  • Differences Between Android and iOS

    Differences Between Android and iOS

    Mobile Application Development: Differences Between Android and iOS and Best Practices

    View article
  • Game Development with Unity

    Game Development with Unity

    Game Development with Unity: From Concept to Final Product

    View article
  • Mastering Programming with Python

    Mastering Programming with Python

    Mastering Programming with Python: Practical Projects and Tips

    View article
  • What are the benefits of websites

    What are the benefits of websites

    Benefits of websites for companies

    View article
  • Web development tutorial A-1

    Web development tutorial A-1

    Lesson 1: Learn HTML from Scratch - A Comprehensive Introduction with Tools Setup

    View article
  • Artificial Intelligence Qwen AI

    Artificial Intelligence Qwen AI

    Qwen AI is a multi-functional AI model that supports languages and handles creative and interactive tasks

    View article
  • The Future of Programmers with AI

    The Future of Programmers with AI

    How will the role of programmers evolve with advancements in artificial intelligence?

    View article