DevTools is the built-in developer tool in every modern browser. It lets you see a page’s structure, change HTML and CSS live in the browser, and see results instantly. It’s an indispensable tool when building layouts.
How to open DevTools
| Method | Keys |
|---|---|
| Universal | F12 |
| Elements tab directly | Ctrl+Shift+C / Cmd+Shift+C |
| Inspect a specific element | Right-click โ “Inspect” |
| Console | Ctrl+Shift+J / Cmd+Option+J |
All examples in this article use Chrome/Chromium. Firefox and Safari have nearly identical interfaces.
The Elements panel
This shows the live DOM tree of the page โ exactly what the browser built from the HTML, after all scripts and templates have run.
What you can do:
- Expand and collapse nodes in the tree.
- Double-click text or an attribute value to edit it in place.
- Right-click โ “Edit as HTML” to change an entire block of markup.
- Drag elements within the tree.
Deleteโ remove an element temporarily (until the page is reloaded).
How to find an element:
- Click the cursor icon (or press
Ctrl+Shift+C). - Hover over any element on the page.
- Click โ DevTools highlights that element in the tree.
The Styles panel
After selecting an element in the Elements panel, the Styles panel appears on the right (or below). It shows all CSS rules applied to the element, ordered from highest to lowest priority:
element.style {} โ inline styles
.post-card { ... } โ element's classes
color: #1a1a1a;
font-size: 1rem;
h2 { ... } โ tag rules
font-weight: bold;
*, ::before, ::after {} โ universal selector
box-sizing: border-box;
user agent stylesheet โ browser default styles
display: block;
Struck-through properties are overridden by a rule with higher specificity.
What you can do:
- Click a colour or size value โ edit it with the keyboard or mouse wheel.
- Click the checkbox to the left of a property โ toggle it on or off.
- Click at the end of a rule and type a new CSS property.
- Click
+in the panel โ add a new rule for the selected selector.
All changes are temporary. They’re gone when the page reloads. Copy working rules back into your CSS file.
Box model
At the bottom of the Styles panel (or in the separate Computed tab) there’s a visual diagram of the box model:
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ margin โ
โ โโโโโโโโโโโโโโโโโโโโโโโโโ โ
โ โ border โ โ
โ โ โโโโโโโโโโโโโโโโโโโ โ โ
โ โ โ padding โ โ โ
โ โ โ โโโโโโโโโโโโโ โ โ โ
โ โ โ โ content โ โ โ โ
โ โ โ โ 320 ร 48 โ โ โ โ
โ โ โ โโโโโโโโโโโโโ โ โ โ
โ โ โโโโโโโโโโโโโโโโโโโ โ โ
โ โโโโโโโโโโโโโโโโโโโโโโโโโ โ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
Click any value in the diagram โ it becomes editable. Great for debugging spacing.
The Console tab
This is where JavaScript errors and network issues appear. For HTML/CSS, look for warnings about invalid attributes or missing resources (images, CSS files):
Failed to load resource: the server responded with a status of 404
GET http://localhost:8000/static/css/styles.css
This means the stylesheet isn’t connected, or its path is wrong.
The Network tab
Shows all resources the page loads. To check whether a CSS file loaded:
- Reload the page with DevTools open.
- Go to Network โ select the
CSSfilter. - Confirm the file returns a
200status.
Practical tips
Debugging “why is this margin so large”
Select the element โ look at the Box Model โ expand parent elements until you find where the extra margin or padding is coming from.
Find an inherited colour
In the Styles panel, scroll down to the Inherited from ... section โ it shows properties coming from ancestor elements.
Try a different font
Select text โ find font-family in Styles โ change the value right there. A quick way to compare several options visually.
Emulate a mobile device
Click the phone icon in DevTools (or press Ctrl+Shift+M). Pick a device from the list or set a custom screen size. DevTools renders the page as it would look on mobile.
Don’t be afraid to experiment in DevTools โ changes never touch your project files. It’s the safest place to test layout ideas.
๐ฌ Comments (0)
No comments yet
Be the first to share your opinion about this article!