HTML Browser DevTools
In this page:
Opening DevTools
Every major browser includes a built-in DevTools panel that can be opened with a keyboard shortcut or through the browser's menu, without installing any extension.
On most browsers this is F12 or Ctrl+Shift+I (Cmd+Option+I on Mac), and it opens docked to the side or bottom of the window.
Example: Opening DevTools
<!-- Press F12 or Ctrl+Shift+I (Cmd+Option+I on Mac) to open DevTools -->
<p>Try it on this page</p>
Inspecting Elements
The Elements panel shows the page's live HTML structure as a tree, letting you click any node to see its exact markup, computed styles, and box model measurements.
You can also edit HTML and CSS live in this panel to experiment, though changes are temporary and vanish on refresh.
Example: Inspecting Elements
<div id="target">Click the element picker, then click this div</div>
Editing HTML Live in the Elements Panel
Double-clicking any text or attribute in the Elements panel makes it directly editable, letting you experiment with markup changes and see the result instantly, without touching the real source file.
Example: Editing HTML Live in the Elements Panel
<p id="editable">Double-click this text in DevTools to edit it live</p>
Console Basics
The Console tab is an interactive JavaScript environment tied to the current page, showing error messages, logged output, and letting you run your own script snippets against the live page.
Example: Console Basics
<script>
console.log('Open the Console tab to see this message');
</script>
Using the Network Tab for HTML Resources
The Network tab lists every file a page requests, including the HTML document itself, stylesheets, scripts, and images, along with each request's status code and load time.
This is the first place to check when an image, script, or stylesheet unexpectedly fails to load on a page.
Example: Using the Network Tab for HTML Resources
<img src="missing-file.jpg" alt="Check the Network tab for a 404 status">
- Editing HTML directly in DevTools and expecting the change to be saved to the real file on the server.
- Ignoring red error messages in the Console tab that explain exactly why a script failed.
- Only checking the Elements tab and never opening the Network tab when a resource fails to load.
- DevTools is a built-in browser toolbox for inspecting, editing, and debugging any webpage.
- The Elements panel lets you view and temporarily edit a page's live HTML and CSS.
- The Console and Network tabs help diagnose JavaScript errors and failed or slow-loading resources.
DevTools ship with every major modern browser, though menu names and shortcuts vary slightly between them.
Chapter Quiz — Complete all 20 topics to unlock
0/20 topics done
Complete these topics first:
- HTML Keyboard Shortcuts
- HTML Browser Support
- HTML Character Sets
- HTML Doctypes
- HTML Audio/Video Reference
- HTML Meta Tags
- HTML ARIA Roles
- HTML Input Validation
- HTML Iframe Security
- HTML Responsive Images
- HTML Web Fonts
- HTML Icon Fonts
- HTML Progress & Meter
- HTML Output Element
- HTML Datalist
- HTML Image Maps
- HTML Browser DevTools
- HTML Validation
- HTML Quiz
- HTML Interview Prep