Google Chrome is more than just a browser—for web developers, it is the primary debugging environment. Chrome DevTools is a suite of web authoring and debugging tools built directly into the browser.
This guide will take you from a DevTools newbie to an expert, covering layout inspection, advanced console hacks, JavaScript debugging with conditional breakpoints, and keyboard shortcuts.
Advertisement
Nextsem Academy
Lesson: p0-5-devtools
Slide 1 / 9
P0.5: Chrome DevTools & Debugging
Google Chrome is more than just a browser—for web developers, it is the primary debugging environment. Chrome DevTools is a suite of web authoring and debugging tools built directly into the browser.
This guide will take you from a DevTools newbie to an expert, covering layout inspection, advanced console hacks, JavaScript debugging with conditional breakpoints, and keyboard shortcuts.
Below is a live, simulated Chrome DevTools environment. Use it to practice inspecting HTML styles, running console tables/timers, setting breakpoints, network throttling, and modifying application local storage:
Chrome DevTools - localhost:3000
▼
📂 DOM Tree (HTML)
<!DOCTYPE html>
<htmllang="en">
<head>...</head>
<body>
<divid="root" class="bg-slate-950 p-6">
<h1class="text-amber-500">Nextsem Academy</h1>
<pclass="text-slate-400">Master DevTools!</p>
</div>
</body>
</html>
💡 Hover over the tags above to see matching styles in the right panel.
🎨 Styles (CSS Editor)
#root {
background-color: #020617;
padding: 24px;
}
h1.text-amber-500 {
color: #f59e0b; /* Amber */
font-weight: 900;
}
p.text-slate-400 {
color: #94a3b8;
font-size: 14px;
}
Slide 4 / 9
1. Navigating the Panels
To open Chrome DevTools, right-click any element on a webpage and select Inspect, or press F12 (Windows/Linux) / Cmd+Option+I (Mac).
🖥️ Elements
Inspect and live-edit HTML tags, CSS rules, margins, and responsiveness.
💻 Console
Read logged outputs, view errors, and run arbitrary JavaScript expressions.
⚙️ Sources
Set breakpoints, step through JavaScript code execution line-by-line.
📡 Network
Track HTTP requests, inspect responses, payloads, and throttle speeds.
💾 Application
Audit LocalStorage, SessionStorage, cookies, and local database storage.
Slide 5 / 9
2. Elements Panel Secrets
The Elements panel is where you inspect layouts, typography, alignments, and colors.
🎨 Live Editing HTML & CSS
Double-click any HTML tag or attribute in the Elements tree to edit it live in the browser. You can click on any CSS rule in the Styles pane to change font-sizes, margins, or colors. These changes are temporary, making it perfect for rapid prototyping!
🖱️ Forcing Pseudo-states (:hover, :active)
Inspecting dropdown menus or hover tooltips is difficult because moving your mouse hides the item. In the Styles pane, click the :hov button and check the :hover or :active checkbox. DevTools freezes the element in that state permanently!
Slide 6 / 9
3. Console Power-User Hacks
While console.log() is useful, Chrome DevTools supports more powerful output formats:
📊 console.table()
Renders an array of objects into a beautiful, sortable table instead of nested dropdowns:
Accurately measures execution speed for benchmarking database fetches or loop functions:
Example
console.time("DB Fetch");
// Run complex task...
console.timeEnd("DB Fetch"); // Outputs: DB Fetch: 1.45ms
Interactive Code
⚡ The $_ Shortcut: In the Console command prompt, typing $_ returns the value of the most recently evaluated expression. Type 2 + 2 (press Enter), then type $_ * 5 to get 20 instantly!
Slide 7 / 9
4. Sources Panel & Debugging
Instead of sprinkling console.log() everywhere, use breakpoints in the Sources panel to pause your code mid-execution and inspect active variable scopes.
1.Open the Sources tab in DevTools.
2.Select your Javascript file from the file explorer sidebar.
3.Click on any line number to place a breakpoint (represented by a blue bullet). Code execution will freeze here.
4.Conditional Breakpoints: Right-click a line number, choose Add conditional breakpoint..., and type a condition (e.g. user.age > 18). Code will only freeze if that statement evaluates to true!
Slide 8 / 9
5. Network & Application Storage
✈️ Network Throttling
Want to see how your site performs for users on slow mobile networks? Open the Network tab, click the Throttling dropdown, and select Slow 3G or Fast 3G to simulate connection lag.
🍪 LocalStorage & Cookie Audits
Open the Application tab, expand the Local Storage or Cookies navigation trees. Here, you can live-edit key-value pairs stored in the browser, or click trash to clear session tokens.
Slide 9 / 9
⌨️ Chrome DevTools Keyboard Shortcuts
Master these to debug like an expert:
Shortcut (Windows)
Shortcut (Mac)
Action
Ctrl + Shift + P
Cmd + Shift + P
Open Command Menu (Search settings, toggle dark mode, capture full screenshots)
Ctrl + Shift + C
Cmd + Shift + C
Toggle Inspector (Click on page to inspect element)