Build a Compact Landing Page with Client‑Side Form Validation
Computer Science
Build a Compact Landing Page with Client‑Side Form Validation
Build a Compact Landing Page with Client‑Side Form Validation
From your existing HTML/CSS foundation, you'll create a polished, responsive landing page that includes a contact form validated entirely in the browser. No backend needed—just static assets you can host anywhere.
What you learn by building this
- Create a fully static web page that adapts to mobile and desktop screens.
- Apply Flexbox and Grid to arrange page sections and achieve responsive layouts.
- Write vanilla JavaScript to validate form fields, display real‑time feedback, and handle successful submissions.
Learning Journey
Project Scaffold & Semantic Structure
2 lessonsSet up the folder, files, and core HTML skeleton for the landing page.
Advanced Styling & Responsive Layout
2 lessonsTurn the static markup into a visually appealing, mobile‑friendly page.
Vanilla JavaScript Form Validation
3 lessonsIntroduce DOM manipulation and build real‑time validation for the contact form.
Polish, Accessibility & Finalization
2 lessonsAdd accessibility touches, final visual tweaks, and prepare the page for deployment.
Public lesson
Create project folder and starter files
Set up your project workspace
You already know the basic HTML structure and CSS selectors, so this setup will keep the files separate and make the next React work easier to organize.
Tasks
1. Create the project folder
- Open VS Code.
- Choose File → Open Folder…
- Create a new folder named:
project-starter
project-starter
- Open that folder in VS Code.
- If VS Code asks whether you trust the folder, choose Yes, I trust the authors.
Tasks
2. Add the three starter files
In the Explorer panel:
- Click the New File button.
- Create:
index.html
index.html
- Repeat for:
style.css
script.js
style.css
script.js
Tasks
3. Connect the files
Open index.html and type this starter structure. Replace the bracketed page title with a name for your own project.
<!doctype html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>[YOUR PROJECT TITLE]</title>
<link rel="stylesheet" href="style.css">
<script src="script.js" defer></script>
</head>
<body>
<main>
<h1>[YOUR PROJECT TITLE]</h1>
<!-- Add the first piece of project content here -->
</main>
</body>
</html>
<!doctype html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>[YOUR PROJECT TITLE]</title>
<link rel="stylesheet" href="style.css">
<script src="script.js" defer></script>
</head>
<body>
<main>
<h1>[YOUR PROJECT TITLE]</h1>
<!-- Add the first piece of project content here -->
</main>
</body>
</html>
The two file links are important: the link connects your styles, and the script connects your JavaScript.
Tasks
Now open style.css and add one visible rule of your choice. For example, change the page background or heading color:
body {
/* Add a background-color or font-family declaration */
}
h1 {
/* Add a color or text-align declaration */
}
body {
/* Add a background-color or font-family declaration */
}
h1 {
/* Add a color or text-align declaration */
}
Tasks
Open script.js and add a message that will help you confirm the file loaded:
console.log("[YOUR PROJECT TITLE] JavaScript loaded");
console.log("[YOUR PROJECT TITLE] JavaScript loaded");
Tasks
Save all three files with Ctrl+S on Windows/Linux or Cmd+S on macOS.
Tasks
4. Open a live preview
If you do not already have it:
- Open the Extensions panel in VS Code.
- Search for Live Server.
- Install the extension published by Ritwick Dey.
Tasks
Then:
- Right-click
index.html. - Choose Open with Live Server.
- A browser window should open with an address similar to:
http://127.0.0.1:5500/index.html
http://127.0.0.1:5500/index.html
Tasks
5. Check that JavaScript is connected
In the preview browser:
- Right-click the page and choose Inspect.
- Open the Console tab.
- Look for your message:
[YOUR PROJECT TITLE] JavaScript loaded
[YOUR PROJECT TITLE] JavaScript loaded
If the page does not look right, check these exact details:
- The files are all in the same folder.
- The names are exactly
index.html,style.css, andscript.js. - The HTML uses
href="style.css". - The HTML uses
src="script.js". - You saved the files before refreshing the preview.
Tasks
Finished setup
Before moving on, confirm that you have:
project-starteropen in VS Codeindex.html,style.css, andscript.jsvisible in Explorer- Your project title visible in the browser
- Your CSS change visible
- Your JavaScript message visible in the browser console
Course Outline
4 modules · 9 lessons
Project Scaffold & Semantic Structure
Advanced Styling & Responsive Layout
Vanilla JavaScript Form Validation
Polish, Accessibility & Finalization
Learn by building your own version.
Remix this public project to open the workspace, follow the guided build, and let the AI mentor teach you through the work instead of doing it for you.