Web Development Basics: HTML, CSS & JavaScript Notes
Read on to explore web development basics: html, css & javascript notes — a beginner-friendly walkthrough by Codekilla.
When you visit any website—whether it's Netflix, Twitter, or your favorite blog—you're looking at the result of three core technologies working together: HTML, CSS, and JavaScript. Think of building a website like constructing a house. HTML is the foundation and walls (structure), CSS is the paint, furniture, and décor (presentation), and JavaScript is the electricity, plumbing, and smart features (behavior). Every single webpage you've ever seen uses these three languages in combination, which is why understanding their distinct roles is the absolute first step in web development. You can't become a developer without mastering this trinity.
- Universal Foundation: Every web framework, library, or tool you'll ever use (React, Vue, Tailwind) ultimately compiles down to HTML, CSS, and JavaScript
- Career Gateway: 70% of entry-level developer jobs require solid HTML/CSS/JavaScript knowledge as a baseline
- Immediate Results: Unlike backend development, you can write code and see visual changes instantly in your browser—perfect for learning
- Platform Independence: These technologies run everywhere—desktop browsers, mobile devices, tablets, even smart TVs
- Problem-Solving Skills: Learning how these three languages interact teaches you fundamental programming concepts that transfer to other languages
HTML (HyperText Markup Language) isn't technically a programming language—it's a markup language. You use it to define the structure and content of a webpage using elements wrapped in angle brackets called tags. Every HTML element tells the browser "this is a heading," "this is a paragraph," or "this is an image."
Here's what basic HTML looks like:
html<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <title>My First Page</title> </head> <body> <header> <h1>Welcome to My Website</h1> <nav> <ul> <li><a href="#home">Home</a></li> <li><a href="#about">About</a></li> </ul> </nav> </header> <main> <article> <h2>My First Blog Post</h2> <p>This is a paragraph with <strong>bold text</strong> and <em>italic text</em>.</p> </article> </main> <footer> <p>© 2024 My Website</p> </footer> </body> </html>
The key principle here is semantic HTML—using tags that describe what the content is, not how it looks. Use <header> for headers, <nav> for navigation, <article> for article content. This makes your code readable by humans, search engines, and screen readers.
CSS (Cascading Style Sheets) controls how your HTML looks. Without CSS, every website would look like a plain Word document from 1995. CSS lets you control colors, fonts, spacing, layouts, animations—everything visual.
Here's a comparison of common approaches:
| Approach | Example | Best For |
|---|---|---|
| Inline CSS | <p style="color: red;">Text</p> | Quick tests, email templates |
| Internal CSS | <style> tag in <head> | Single-page experiments |
| External CSS | <link rel="stylesheet" href="style.css"> | Real projects (always use this) |
Here's external CSS in action:
css/* Reset default margins */ * { margin: 0; padding: 0; box-sizing: border-box; } body { font-family: 'Arial', sans-serif; line-height: 1.6; color: #333; background-color: #f4f4f4; } header { background: linear-gradient(135deg, #667eea 0%, #764ba2 100%); color: white; padding: 2rem; text-align: center; } nav ul { list-style: none; display: flex; gap: 1.5rem; justify-content: center; margin-top: 1rem; } nav a { color: white; text-decoration: none; font-weight: bold; transition: opacity 0.3s ease; } nav a:hover { opacity: 0.8; } main { max-width: 800px; margin: 2rem auto; padding: 2rem; background: white; border-radius: 8px; box-shadow: 0 2px 10px rgba(0,0,0,0.1); }
The "cascading" part means styles flow from parent to child elements, and more specific selectors override general ones. Master the box model (content, padding, border, margin) and flexbox/grid for layouts, and you'll handle 90% of styling challenges.
JavaScript is the only true programming language of the three. While HTML and CSS are declarative (you describe what you want), JavaScript is imperative (you write step-by-step instructions). JavaScript handles user interactions, data fetching, animations, form validation—anything that requires logic or changes over time.
javascript// DOM Manipulation - changing HTML with JavaScript const header = document.querySelector('header h1'); header.textContent = 'JavaScript is Awesome!'; // Event Handling - responding to user actions const buttons = document.querySelectorAll('nav a'); buttons.forEach(button => { button.addEventListener('click', (event) => { event.preventDefault(); alert(`You clicked ${button.textContent}`); }); }); // Data Fetching - getting information from servers async function fetchUserData() { try { const response = await fetch('https://api.example.com/users/1'); const data = await response.json(); const userDiv = document.createElement('div'); userDiv.innerHTML = ` <h3>${data.name}</h3> <p>${data.email}</p> `; document.querySelector('main').appendChild(userDiv); } catch (error) { console.error('Failed to fetch data:', error); } } // Form Validation - checking user input document.querySelector('form')?.addEventListener('submit', (e) => { e.preventDefault(); const email = document.querySelector('#email').value; if (!email.includes('@')) { alert('Please enter a valid email'); return; } console.log('Form submitted successfully!'); });
Modern JavaScript (ES6+) includes powerful features like arrow functions, async/await, destructuring, and modules. Don't try to memorize everything—learn by building projects.
The magic happens when all three technologies collaborate. HTML provides the content structure, CSS makes it look professional, and JavaScript adds interactivity. Here's the workflow:
| Step | What Happens | Technology |
|---|---|---|
| 1. Browser requests page | Server sends HTML file | HTML |
| 2. Browser parses HTML | Discovers <link> and <script> tags | HTML |
| 3. Downloads CSS | Applies styles to HTML elements | CSS |
| 4. Downloads JavaScript | Executes code, modifies DOM | JavaScript |
| 5. Page is interactive | User can click, scroll, type | All three |
Think of it like a restaurant: HTML is the menu structure (appetizers, mains, desserts), CSS is the menu design (fonts, colors, layout), and JavaScript is the waiter who takes your order and brings your food (dynamic behavior).
| Need | Reach For | Example |
|---|---|---|
| Page structure | HTML semantic tags | <header>, <nav>, <main>, <footer> |
| Text styling | CSS properties | color, font-size, font-weight |
| Layout | CSS Flexbox/Grid | display: flex;, grid-template-columns |
| Spacing | CSS box model | margin, padding, gap |
| User interaction | JavaScript events | addEventListener('click', ...) |
| Change content | JavaScript DOM | textContent, innerHTML, appendChild() |
| Load external data | JavaScript fetch | fetch(), async/await |
| Form handling | JavaScript + HTML | <form>, event.preventDefault() |
- Using
<div>for everything — Generic divs make your code meaningless. Use semantic tags like<article>,<section>,<aside>so screen readers and search engines understand your content structure - Inline styles everywhere — Writing
style="color: red;"on every element creates unmaintainable spaghetti code. Always use external CSS files for real projects - Forgetting
<!DOCTYPE html>— Without this declaration, browsers render in "quirks mode" and your CSS might break in weird ways - Not linking CSS/JS files correctly — File paths are relative to the HTML file. If
style.cssis in acssfolder, use<link href="css/style.css">, not juststyle.css - Manipulating DOM before it loads — If your JavaScript runs before HTML elements exist, selectors return
null. Either put<script>at the bottom of<body>or useDOMContentLoadedevent - Overusing IDs in CSS — IDs have high specificity and can only be used once per page. Prefer classes (
.button) over IDs (#button) for styling - Copy-pasting without understanding — Grabbing code from StackOverflow is fine, but read what each line does. Otherwise you'll never learn to debug or adapt it
💡 Think Like a Programmer: Start every project by sketching the HTML structure first, then layer on CSS for appearance, and finally add JavaScript only where you need dynamic behavior. This separation of concerns keeps your code clean and debuggable.
Keep Reading
Domain & Hosting Connection: DNS, Hosting & Email
Read on to explore domain & hosting connection: dns, hosting & email — a beginner-friendly walkthrough by Codekilla.
Web Hosting Fundamentals: Types, Resources & Plans
Read on to explore web hosting fundamentals: types, resources & plans — a beginner-friendly walkthrough by Codekilla.
Domain Purchase & Registration Guide
Read on to explore domain purchase & registration guide — a beginner-friendly walkthrough by Codekilla.
