Form Stage 1: Basic Structure
Learn the fundamentals of HTML forms with the form element, text inputs, and submit buttons.
Loading...
Loading exercise code...
Exercise: Form Stage 1 - Basic Structure
Objectives
In this exercise, you will:
- Learn the
<form>element and its basic attributes - Understand text input fields (
<input type="text">) - Practice creating submit buttons
- Learn basic form layout and styling
- Complete your first interactive form challenge!
What Youâll Learn
Form Elements:
<form>- Container for all form controls<label>- Descriptive text for form fields<input>- Input field for user data<button>or<input type="submit">- Submit button
Form Attributes:
action- Where to send the form datamethod- How to send data (GET or POST)forattribute on labels - Links label to input by ID
Input Types:
type="text"- Single-line text inputtype="submit"- Submits the formtype="password"- Masked password inputtype="email"- Email validation
The Treasure Hunt Challenge
This stage is part of an interactive âTreasure Huntâ game!
Your Challenge:
- Read the clue carefully
- Think about what HTML tag answers the question
- Type your answer in the text field
- Click âNext Challengeâ to continue
Can you answer the clue and proceed to Stage 2?
Tips for Success
- Look at the form structure carefully
- Each
<label>has aforattribute matching an inputâsid - The form will navigate to the next stage when submitted
- Think about what each HTML tag does
- Donât overthink it - the answers are usually simple tag names!
Form Best Practices
- Always use
<label>for accessibility - Connect labels to inputs using
forandid - Use proper
typeattributes for inputs - Provide clear instructions
- Add visual feedback for user interactions
- Use CSS to style and layout your forms
Next Steps
After completing this exercise:
- Experiment changing the form styling
- Try modifying the action URL
- Test the form with different answers
- Proceed to Stage 2 for more challenges!