Complete Guide to HTML, CSS, and JavaScript
This guide is designed to provide a comprehensive and detailed journey through the core front-end
web development languages: HTML, CSS, and JavaScript. Whether you're a beginner or someone
brushing up on fundamentals, this guide covers everything step-by-step.
Prepared by ChatGPT | 2025
Section 1: HTML (HyperText Markup Language)
1. What is HTML?
- HTML is the standard markup language for creating Web pages.
- It describes the structure of a webpage using elements.
- Elements are represented by tags.
2. Basic HTML Structure:
<!DOCTYPE html>
<html>
<head>
<title>Page Title</title>
</head>
<body>
<h1>This is a Heading</h1>
<p>This is a paragraph.</p>
</body>
</html>
3. Common Tags:
- Headings: <h1> to <h6>
- Paragraph: <p>
- Links: <a href="url">Link text</a>
- Images: <img src="image.jpg" alt="description">
- Lists: <ul>, <ol>, <li>
- Tables: <table>, <tr>, <td>, <th>
- Forms: <form>, <input>, <textarea>, <select>, <button>
4. Semantic HTML:
- Elements like <header>, <nav>, <main>, <footer>, <section>, <article> enhance accessibility.
5. HTML Attributes:
- class, id, href, src, alt, style, title, etc.
Section 2: CSS (Cascading Style Sheets)
1. What is CSS?
- CSS describes how HTML elements are to be displayed.
- External, internal, or inline styles can be applied.
2. Syntax:
selector {
property: value;
3. Selectors:
- Element: p, h1, div
- Class: .classname
- ID: #idname
- Grouping: h1, p, div
- Descendant: div p
4. Common Properties:
- Color: color, background-color
- Text: font-family, font-size, font-weight, text-align
- Box Model: margin, border, padding, width, height
- Layout: display, position, float, flexbox, grid
5. Responsive Design:
- Media Queries: @media screen and (max-width: 600px) { ... }
- Mobile-first approach
6. Transitions and Animations:
- transition, animation-name, animation-duration
7. Advanced Topics:
- Variables: --main-color
- Pseudo-elements: ::before, ::after
- Pseudo-classes: :hover, :nth-child()
Section 3: JavaScript
1. What is JavaScript?
- A scripting language to create dynamic content.
- Runs in the browser and interacts with HTML/CSS.
2. Basics:
- Variables: var, let, const
- Data Types: string, number, boolean, object, array, null, undefined
- Operators: +, -, *, /, ==, ===, !=, &&, ||
3. Functions:
function greet(name) {
return "Hello " + name;
4. Events:
- onclick, onmouseover, onkeydown, etc.
- Example: <button onclick="alert('Clicked')">Click Me</button>
5. DOM Manipulation:
- document.getElementById, querySelector, innerHTML, style
6. Loops and Conditionals:
- if, else, switch, for, while
7. Arrays and Objects:
- arr = [1, 2, 3]; obj = {name: "John", age: 30};
8. ES6+ Features:
- Arrow functions, spread/rest, destructuring, classes
9. Asynchronous JS:
- Callbacks, Promises, async/await
10. Working with APIs:
- fetch('url').then().catch()
11. Debugging and Dev Tools:
- console.log, breakpoints, browser tools