HTML/CSS Tutorial: Creating Tables, Forms, and Input Elements


When to Use a Table
Websites often need to display data in a structured format.
For example, the following types of information are best presented using tables:
User lists
Product price lists
Schedules
Grade sheets
Order histories
Board listings
This is why Table(표) is used to represent data organized in rows and columns.
Creating a Basic Table
The most basic table is written as follows:
<table>
<tr>
<th>Name</th>
<th>Age</th>
<th>Occupation</th>
</tr>
<tr>
<td>Hong Gil-dong</td>
<td>30</td>
<td>Developer</td>
</tr>
<tr>
<td>Kim Cheolsu</td>
<td>28</td>
<td>Designer</td>
</tr>
</table>
The role of each tag is as follows:
<table>: The entire table<tr>: A row (Row)<th>: Header cell<td>: Data cell
These four tags are most commonly used when creating tables.
Understanding Table Structure
A table is made up of rows (Row) and columns (Column).
For example, it looks like this:
Name | Age | Occupation |
|---|---|---|
Hong Gil-dong | 30 | Developer |
Kim Cheolsu | 28 | Designer |
In HTML, tables like this are created by combining <tr>, <th>, and <td> tags.
What is a Form?
Websites not only display information but also need to collect user input.
For example, the following features require forms:
Login
Sign up
Search
Contact us
Bookings
Post comments
This is why Form(폼) is used to create such features.
A form sends user-input data to the server.
Creating a Form Tag
The most basic form looks like this:
<form>
</form>
All input elements are typically written inside the form tag.
Later, when learning PHP or JavaScript, you'll process actual data using forms.
The Input Tag
The most commonly used input tag is input.
<input type="text">
This creates the basic text input field.
However, the input tag supports various types.
Different Input Types
Basic Text
<input type="text">
Password
<input type="password">
Inputed text appears as ●●●.
<input type="email">
Used for inputting email format.
Number
<input type="number">
Allows only numeric input.
Date
<input type="date">
Allows selecting dates using a calendar.
Checkbox
<input type="checkbox">
Allows selecting multiple options at once.
Commonly used for things like selecting hobbies.
Radio Buttons
<input type="radio" name="gender"> 남자
<input type="radio" name="gender"> 여자
Allows selecting only one option from multiple options.
The Textarea Tag
Use the textarea tag for longer text input.
<textarea></textarea>
Commonly used for multi-line inputs like contact forms or self-introductions.
The Select Tag
Use select to create a dropdown list from which users can choose one option.
<select>
<option>Seoul</option>
<option>Busan</option>
<option>Daegu</option>
<option>Gwangju</option>
</select>
It appears as a dropdown menu and saves space.
Creating Buttons
Buttons are frequently used in forms.
<button>Sign Up</button>
Or:
<input type="submit" value="Login">
Both methods can create buttons.
Creating a Simple Sign-Up Form
You can now create a basic input screen using the tags learned so far.
<form>
<p>Name</p>
<input type="text">
<p>Email</p>
<input type="email">
<p>Password</p>
<input type="password">
<p>Bio</p>
<textarea></textarea>
<br><br>
<button>Sign Up</button>
</form>
Although it's not styled yet, this basic structure closely resembles a real sign-up page.
In the next lesson, you'll learn CSS to make it look much better.
Using the Label Tag
It's helpful to pair input fields with labels for clarity.
<label>Name</label>
<input type="text">
Using the label tag makes it clear what users should input.
It's also recommended for accessibility reasons.
Common Mistakes for Beginners
1. Creating Input Fields Without a Form Tag
It's best to get into the habit of writing input fields inside a form tag whenever possible.
2. Using Tables for Layout Purposes
In the past, tables were used for layout purposes, but this is rarely done today.
For layouts, CSS (Flexbox, Grid) is now the standard.
3. Using Input Instead of Textarea
Use input for single-line input,
and textarea for multi-line input.
4. Forgetting to Add a Name Attribute to Radio Buttons
Radio buttons need the same name attribute to allow selecting only one option.
Key Takeaways from This Lesson
Let's review what we've learned today:
<table>creates the entire table structure.<tr>represents a row (Row).<th>is for header cells.<td>is for data cells.<form>manages input data.<input>creates various types of input fields.<textarea>is used for multi-line text input.<select>creates dropdown lists.<button>creates buttons.
These tags are fundamental elements used in almost all websites for features like sign-up, login, and board creation.
In Closing
This lesson covered how to use tables to organize data and forms to collect user input.
While the page may look simple now, most core website functionalities start with these input elements.
In the next lesson, we'll learn about semantic tags (header, nav, main, section, footer), which help structure HTML documents more systematically and meaningfully. This is important for search engine optimization (SEO) and maintainability—be sure to learn this as well.
FAQ
Why should I use a table instead of other layout methods?
Tables are best for displaying structured data like lists, schedules, and price tables. They're not recommended for page layouts anymore, which should be done using CSS Flexbox or Grid.
What's the difference between input type="text" and textarea?
Use input type="text" for single-line text entry (like names), and textarea for multi-line entries (like descriptions or bios).
Korean Source
This article is an English localization of a Korean-language report from BlogScore. Original: [Html/CSS 강좌] 5강 표(Table), 폼(Form), 입력 요소 만들기