Browser DevTools
DevTools (Developer Tools) are built into every modern browser. They let you:
- See the HTML structure of any page
- View and modify CSS in real-time
- Debug JavaScript errors
- Monitor network requests
- Test responsive designs
This is the X-ray vision of web development.
Opening DevTools
Keyboard: F12 or Ctrl + Shift + I (Win) / Cmd + Option + I (Mac)Mouse: Right-click → "Inspect"Menu: Menu → More Tools → Developer ToolsThe DevTools Interface
┌──────────────────────────────────────────────────────────────────┐│ Elements │ Console │ Sources │ Network │ Performance │ ... │├──────────────────────────────────────────────────────────────────┤│ ││ LEFT PANEL │ RIGHT PANEL ││ HTML Structure │ Styles ││ │ Computed ││ ▼ <html> │ Event Listeners ││ ▼ <body> │ ││ ▼ <header> │ .header { ││ <nav>...</nav> │ background: #333; ││ </header> │ padding: 20px; ││ ▼ <main> │ } ││ ... │ ││ │└──────────────────────────────────────────────────────────────────┘Elements Tab: The X-Ray
The Elements tab shows the page's HTML structure and CSS.
What You Can Do
1. Inspect Any Element — Right-click any element on page → "Inspect"
2. See HTML Structure — Expand/collapse elements with arrows
3. View Applied CSS — Select an element to see all CSS rules
4. Edit HTML Live — Double-click to edit (changes are temporary!)
5. Edit CSS Live — Click any CSS value to edit in real-time
Elements Tab Exercises
✅ Elements Tab Practice
0/4Console Tab: JavaScript Playground
The Console shows JavaScript errors and lets you run code.
What You Can Do:
Console Uses
1. See Errors — JavaScript errors appear in red
2. See Logs — console.log() output appears here
3. Run JavaScript — Type any JavaScript and press Enter
Useful Console Commands
// See page titledocument.title // Select an elementdocument.querySelector("h1") // Change page titledocument.title = "New Title!" // Get all linksdocument.querySelectorAll("a") // Alert messagealert("Hello from console!") // Count elementsdocument.querySelectorAll("a").lengthConsole Exercises
✅ Console Tab Practice
0/4Network Tab: What's Loading
The Network tab shows all files loaded by the page.
Common Uses:
- Check if files are loading
- See slow resources
- Monitor API calls
- Debug missing images
Device Mode: Responsive Testing
Test how your page looks on different devices.
How to Enable Device Mode
- Open DevTools
- Click the device icon (📱) in top-left
- Or press
Ctrl + Shift + M(Chrome)
You can:
- Select preset devices (iPhone, iPad, etc.)
- Set custom dimensions
- Simulate touch events
DevTools Cheat Sheet
Lesson Summary
Essential Tabs
- Elements: Inspect and edit HTML/CSS
- Console: JavaScript errors and testing
- Network: See loaded resources
Key Skills
- Inspect any element on any website
- Modify HTML/CSS in real-time (temporary)
- Run JavaScript commands
- Debug by reading console errors
The Superpower
DevTools lets you understand HOW any website is built by examining its code directly.
📝 Quiz
1/3What keyboard shortcut opens DevTools?
Next Up
Lesson 2.6: Code Autopsy
Practice analyzing AI-generated code!