MGU Computer Science Series — Web Development: HTML, CSS, and JavaScript
Part I: Foundations of the Web
Browsers · Developer Tools · Inspection · Debugging
Chapter 4 of 30
4
MGU Computer Science Series  ·  Web Development: HTML, CSS, and JavaScript  ·  Library Textbook Edition

Chapter 4:
Browsers, Developer Tools,
and Page Inspection

Using the browser itself as a development environment — page source, the Elements panel, CSS inspection, the console, the network panel, and responsive preview

■ Part I of VII ■

■ 10 Sections  •  Chapter 4 of 30 ■

Builds directly on Chapters 1–3 — no prior HTML, CSS, or JavaScript code required yet

Chapter Introduction and Learning Objectives

This chapter introduces the browser as something more than a window to the web. The browser is also a development environment. Professional web developers spend as much time inside their browser's developer tools as they do inside their code editor. This chapter teaches you to use those tools from the beginning, because they will support everything you build throughout this course.

By the end of this chapter, you will be able to open developer tools in any major browser, read page source code, inspect the HTML structure of a live page, examine CSS rules, read basic console output, identify errors, preview pages at different screen sizes, and use these tools to understand and debug your own projects.

Opening Question

You build a page. It loads in the browser, but the text is unstyled, plain black on white, with none of the colors or spacing you wrote in your CSS file. Nothing in your HTML or CSS editor tells you what went wrong — the code looks correct on the screen. Where do you look? This chapter answers that question. The browser itself, through its built-in developer tools, can show you exactly what happened: what files loaded, what didn't, what HTML the browser actually built, and what CSS rules are or are not being applied. Learning to read that information is one of the most valuable habits you will develop as a web developer.

10Sections
10Objectives
14Key Terms
30Total Chapters

Learning Objectives

By the end of this chapter, you should be able to:

  1. 1Explain the browser's two roles — as a user interface and as a developer tool — and why every visible page is built from inspectable code.
  2. 2Open developer tools in any major browser using a menu option or a keyboard shortcut.
  3. 3Distinguish between viewing page source and inspecting the live DOM in the Elements panel.
  4. 4Use the Elements panel and the element picker to read and navigate a page's HTML structure.
  5. 5Use the Styles and Computed panels to inspect CSS rules applied to an element, including overridden declarations.
  6. 6Read and interpret Console messages, including errors, warnings, and log messages.
  7. 7Use the Network panel to confirm that linked files loaded successfully and to identify missing files.
  8. 8Use the responsive preview tool to test a page's layout at different screen widths.
  9. 9Apply a systematic debugging procedure to diagnose missing files, structural mistakes, and CSS conflicts.
  10. 10Explain why developer tools are also a learning tool for studying how real websites are built, not only a debugging tool for your own pages.

Sections at a Glance

Sections 4.1 – 4.3
Getting Oriented: Browsers, Source Code, and Opening the Tools
Browser Engines · Page Source · Developer Tools Panels

Browsers as Web Interpreters

Every website you visit is made of files: HTML files, CSS files, JavaScript files, images, fonts, and other resources. None of those files are visible to you directly. What you see when you visit a website is the browser's interpretation of those files. The browser reads the code and turns it into something you can see, read, interact with, and navigate.

This is an important idea. The browser does not simply display files the way a document viewer displays a PDF. It actively reads, parses, and renders the code according to rules defined by web standards. When HTML describes a heading, the browser displays a heading. When CSS says a background should be blue, the browser paints it blue. When JavaScript tells a button to respond to a click, the browser wires up that behavior.

Different browsers do this using different engines. These engines all follow the same web standards, so well-written pages should look and behave consistently across all of them. In practice there can be small differences, which is why cross-browser testing is part of professional web development.

BrowserRendering Engine
Chrome, EdgeBlink
FirefoxGecko
SafariWebKit

For this course, you may use any major browser. The instructions in this chapter use Chrome, which has especially powerful developer tools and is widely used in professional and educational web development. The same features exist in all major browsers, and the differences are minor.

The Browser's Two Roles

Role 1
User Interface
For ordinary users, the browser is a tool for reading, watching, shopping, communicating, and navigating. Users care about what the page looks like and how it behaves, not about the code behind it.
Role 2
Developer Tool
For developers, the browser is also a reading and inspection tool. Every page you visit is a live document you can examine from the inside — its HTML, its CSS, its JavaScript, and any errors that occurred.
Study Note

You already know how to use a browser as a user. This chapter teaches you to use it as a developer — a skill that supports everything else in this course.

Viewing Page Source

Every page on the web has a source — the raw code that was sent to your browser before it was interpreted and displayed. Viewing the source is the simplest way to see a page's HTML.

BrowserShortcut
Chrome (Windows / Linux)Ctrl + U
Chrome (Mac)Cmd + Option + U
Firefox (Windows / Linux)Ctrl + U
Firefox (Mac)Cmd + U
Edge (Windows)Ctrl + U
Safari (Mac)Cmd + Option + U

You can also right-click anywhere on a page and look for View Page Source in the context menu. A new tab opens showing the raw HTML exactly as it was delivered by the server — the <!DOCTYPE html> declaration, the <html> element, the <head> and <body> sections, and every linked CSS file, JavaScript file, and image.

An Important Limitation

Page source shows the original HTML as it was written and delivered — useful for understanding structure and finding linked resources. But it has a limit: it shows the HTML before JavaScript had a chance to change it. Many modern websites use JavaScript to modify the page after it loads — adding content, changing styles, or updating structure. Page source does not show those changes. For seeing the page as it actually exists right now, you need developer tools, introduced in Section 4.3.

Try It
Reading the source of a simple page
  • Step 1Open a browser and visit a simple website — a school page, a small organization's site, or a personal page. Avoid large commercial sites for now; their source code is often minified and hard to read.
  • Step 2View the page source using the shortcut or context menu.
  • Step 3Read through the code. Find the <head> section. Find the <title>. Find at least one heading and one paragraph in the <body>.

You may not understand all of it yet. That is fine. The goal here is to see that every visible page is built from readable code, and that code is accessible to you.

Opening Developer Tools

Developer tools are a built-in feature of every major browser. They give you direct access to a page's structure, styles, scripts, network requests, and much more. Professional web developers use them constantly, and you will use them throughout this course.

The easiest method for new developers is to right-click anywhere on a page and select Inspect or Inspect Element from the context menu. You can also use a keyboard shortcut.

BrowserShortcut
Chrome, Edge, Firefox (Windows / Linux)F12 or Ctrl + Shift + I
Chrome, Edge, Firefox (Mac)Cmd + Option + I
Safari (Mac)Cmd + Option + I — requires enabling the Develop menu first
Note for Safari Users

Safari requires you to enable developer tools before the first use. Open Safari Preferences, go to the Advanced tab, and check "Show Develop menu in menu bar." After that, the shortcut opens the tools.

When developer tools open, they appear as a panel docked to the bottom, the side, or detached as a separate window — choose whichever layout lets you see both the page and the tools comfortably. The tools are organized into panels, accessible as tabs along the top. Four panels matter most for now:

Panel
Elements
Shows the HTML structure of the page and lets you inspect and edit it live. The panel you will use most often.
Panel
Console
Shows JavaScript messages, warnings, and errors. You can also type JavaScript directly into it.
Panel
Network
Shows every file the browser requested to load the page — HTML, CSS, JavaScript, images, and fonts.
Panel
Sources
Shows the source files for the page. Useful for reading JavaScript and, later in the course, setting breakpoints.

Each panel is introduced in this chapter. You will use them all more deeply as the course continues.

Sections 4.4 – 4.6
Reading the Page: Elements, Styles, and the Console
The DOM · CSS Inspection · Console Messages

Inspecting HTML Elements

The Elements panel is the heart of developer tools. It shows you the page's DOM and updates in real time as the page changes.

What the DOM Is

The DOM stands for Document Object Model. When a browser loads an HTML file, it does not simply display the text of the file. It reads the HTML and builds an internal representation of the page as a tree of nodes — elements, text, attributes, and comments. This tree is the DOM. It is similar to the original HTML, but it has been parsed and organized by the browser, and it reflects any changes JavaScript has made. This is why the Elements panel is more useful than page source when JavaScript has modified the page. You will learn much more about the DOM in Part IV. For now, think of it as the browser's live, working version of the page.

When you open the Elements panel, you see a tree of HTML elements. Elements that contain other elements have a small triangle next to them — click it to expand or collapse that element's children. You can navigate the entire structure of a page this way.

A page as shown in the Elements panel
▼ <html lang="en"> ▼ <head> <meta charset="UTF-8"> <title>My Page</title> </head> ▼ <body> ▼ <header> <h1>Welcome</h1> </header> ▼ <main> ▼ <section> <h2>About This Page</h2> <p>This is a sample page.</p> </section> </main> </body> </html>

Each line represents one element. Indentation shows nesting. Clicking any element selects it, which highlights the corresponding area in the browser viewport and shows its CSS in the Styles panel (Section 4.5).

The Element Picker

Instead of navigating the tree manually, you can use the element picker to click directly on a part of the page and jump to its code in the Elements panel. Find the picker button — a small cursor-and-box icon — in the top-left corner of developer tools.

Try It
Using the element picker
  • Step 1Open any web page and open developer tools.
  • Step 2Activate the element picker, then click on a heading on the page.
  • Step 3Watch the Elements panel jump to and highlight that element's code.
  • Step 4Try again with a paragraph, a link, an image, and a navigation menu.
Live Editing

Double-click any element name, attribute, or text content in the Elements panel and you can change it — the page updates immediately. This editing is not permanent; refreshing the page resets it. Live editing is enormously useful for experimenting before you write a change in your code editor.

Inspecting CSS Rules

The right side of the Elements panel shows the CSS rules that apply to the currently selected element, in a sub-panel usually called Styles. This is one of the most important tools for understanding and debugging layout and visual design.

When you select an element, the Styles panel displays every CSS rule affecting it, ordered from most specific at the top to least specific at the bottom. At the very bottom you typically see the browser's built-in default styles. Each rule shows the selector that matched, the property names, and the values:

h2 { font-size: 1.5rem; margin-bottom: 0.75rem; color: #222222; }

If a rule has been overridden by a more specific rule, the overridden declaration appears with a strikethrough, indicating it exists but is not being applied. This stacking — most specific at top, struck-through losers below — reflects the CSS cascade, which Chapter 12 covers in depth. Understanding this panel early makes the cascade much easier to learn later.

Live CSS Editing

Click any property value in the Styles panel to change it; the page updates immediately. Click the checkbox next to a declaration to toggle it on or off — a useful way to see what a property is doing by seeing what happens without it. You can also add a new declaration by clicking at the end of a rule block, typing a property name, pressing Tab, typing a value, and pressing Enter. None of this is saved; refreshing resets everything.

The Computed Panel

Next to Styles is a panel called Computed. While Styles shows the rules as written in CSS files, Computed shows the final calculated value for every CSS property on the selected element, after all rules and inheritance are resolved. Computed is useful when you want the actual numeric value of something — the exact pixel width of an element, the final font size after relative units have been calculated, or the margin values around an element. It is especially helpful when debugging layout problems.

Practical Exercise
Inspecting and editing CSS live
  • Step 1Open developer tools and select the Elements panel.
  • Step 2Use the element picker to click on a paragraph of text.
  • Step 3In the Styles panel, find the rule setting the font size. What value does it show?
  • Step 4Change the font size to something larger. Does the paragraph update?
  • Step 5Switch to the Computed panel. What is the computed font size in pixels? What are the margin values?
  • Step 6Refresh the page to restore everything.

The Console at an Introductory Level

The Console panel is where JavaScript messages appear. Browsers use it to report errors, warnings, and information. You do not need to understand JavaScript yet to benefit from it — even in the HTML and CSS parts of this course, the console helps you catch errors.

Click the Console tab to switch to it, or press Esc while developer tools are open to toggle a console drawer at the bottom of any panel.

Red
Errors
Something went wrong — a missing file, a JavaScript syntax mistake, a network problem, or another issue that prevented something from loading or running.
Yellow
Warnings
Something that may be a problem but did not necessarily break anything — an outdated feature, an accessibility issue, or a potential conflict.
Standard
Log Messages
Messages JavaScript code deliberately sends using console.log(). You will use this in Part IV. For now, these are normal and intentional.

Reading Errors in the Console

The most common early error for beginners involves missing files: if your HTML references a CSS file, an image, or a JavaScript file that does not exist at the expected path, the console shows an error such as:

GET http://localhost/css/main.css net::ERR_FILE_NOT_FOUND

This tells you the browser tried to load css/main.css, could not find it, and produced an error — exactly the kind of path problem Chapter 3 discussed. Other common early errors include:

Uncaught SyntaxError: Unexpected token
What This Means

A syntax error means JavaScript code has a mistake. Even if you have not written any JavaScript yourself, some pages include it, and errors in that code will appear here.

Failed to load resource: the server responded with a status of 404

A 404 status means a requested file was not found — another missing-file error, this time returned by a web server rather than a local path. For now, the most useful habit is to check the console whenever something on a page is not working. A red error message is almost always the fastest way to find the problem.

Typing in the Console

The console also accepts JavaScript input. Click in the console's input area, type an expression, and press Enter. Try:

> 2 + 2 4
> document.title "MGU Web Development"

This is your first interaction with JavaScript and the DOM, even before Part IV. You are asking the browser for the value of document.title — the title of the current document — and the browser is answering. Part IV explains what document is and how to use it systematically. For now, it is good to know the console is available for quick experiments.

Sections 4.7 – 4.10
Putting It to Work: Finding Errors, Testing Layouts, and Building a Habit
Debugging · Network Requests · Responsive Preview · Inspection Routine

Finding Errors

A significant part of web development is diagnosing and fixing problems. Developer tools are your primary diagnostic instrument. Different problems appear in different panels.

ProblemWhere to Look
HTML structure errorsThe Elements panel. If elements are nested incorrectly or a closing tag is missing, the browser attempts to fix your code automatically. Comparing your source to the Elements panel reveals the difference.
CSS not applyingThe Styles panel for the affected element. If the property is struck through, a more specific rule is overriding it. If it does not appear at all, your selector may not match, or the file may not be linked correctly.
Missing filesThe Console and the Network panel. A red console error or a 404 status tells you a file was requested but not found. Check the path in your HTML.
JavaScript errorsThe Console, as red error messages. Part IV teaches you to read and fix these systematically.
A Debugging Procedure
  1. Check the Console for red error messages. Read them. If a file is missing, fix the path.
  2. If the HTML looks wrong, inspect the element in the Elements panel. Compare what the browser built to what you wrote.
  3. If a CSS style is not applying, inspect the element and look at the Styles panel. Find where the property is set. Look for overriding rules and incorrect selectors.
  4. If all else fails, look at your source file carefully for typos, missing quotes, unclosed tags, and incorrect filenames.
Worked Example
Diagnosing a missing stylesheet
  • The PageAn HTML file links <link rel="stylesheet" href="css/styles.css">, but the page appears unstyled — plain black text on white.
  • ConsoleShows GET http://localhost/css/styles.css net::ERR_FILE_NOT_FOUND. The browser looked for css/styles.css and did not find it.
  • InvestigateThe project folder shows the CSS file actually lives at styles.css, in the project root — not inside a css folder.
  • FixChange the link to <link rel="stylesheet" href="styles.css">.
  • ResultReload the page. The console error is gone, and the styles appear. This is a real beginner problem that happens frequently — the console identified it in seconds.

Network Panel Basics

The Network panel shows every resource the browser requested to load the current page — the HTML file itself, CSS files, JavaScript files, images, fonts, and any data the page fetched after loading.

The Network panel only captures requests made while it is open. If you switch to it after the page has already loaded, you will see an empty panel. Open developer tools, switch to Network, and then reload the page with F5, Ctrl + R, or Cmd + R to capture a full page load.

Status CodeMeaning
200The resource loaded successfully.
304The resource was loaded from the browser's cache (not re-downloaded).
404The resource was not found.
500There was a server error.

Each row in the Network panel also shows the resource's Name (filename), Type (document, stylesheet, script, image, font, and so on), Size, and Time to load.

What This Panel Is Useful For Now

At this stage, the Network panel is most useful for two things: confirming that files loaded (a 404 means a file was not found — the same information the console reports, but easier to scan as a list), and seeing which files a page depends on, which is a useful habit for learning from existing pages. Later in the course, the panel becomes important for performance and for working with fetched data in Part V.

Try It
A simple Network panel exercise
  • Step 1Open developer tools and switch to the Network panel.
  • Step 2Reload a simple web page. Count the number of requests.
  • Step 3Find the HTML document request. What is its status code?
  • Step 4Find any CSS requests. Are they all status 200? Look for any 404 errors and note which files were missing.

Responsive Preview Tools

One of the most practical features in developer tools is the responsive preview tool, sometimes called the Device Toolbar or Device Mode. It lets you preview a page at different screen sizes without using a real phone or tablet.

Responsive design — making pages work well on phones, tablets, and desktop screens — is a central skill in this course, studied formally in Chapter 17. You can and should start using the responsive preview tool now, because it will help you understand why pages look different on different devices.

In Chrome and Edge, click the small device icon in the top-left corner of developer tools — it looks like a phone in front of a tablet. The viewport then changes to a device-sized preview, with dimensions shown at the top. You can drag the edges, type specific dimensions, or choose a preset device from the dropdown.

Preset Devices

The device dropdown includes presets for common phones and tablets. Selecting one sets the viewport to that device's resolution and simulates its pixel density, which affects how certain CSS units behave. Presets are useful for quick checks; real device testing on actual hardware still matters later in the course, since the simulator cannot perfectly replicate every device behavior.

Try It
Using responsive preview now
  • Step 1Open any web page and activate the responsive preview tool.
  • Step 2Set the width to about 375 pixels — a common phone screen width. Is the text readable? Is the navigation usable? Does anything overflow the screen horizontally?
  • Step 3Widen the viewport to about 1200 pixels — a common laptop width — and compare the two views.
What Responsive Preview Cannot Do

It simulates screen sizes, but not everything. It cannot replicate touch interactions, device performance, exact font rendering on a given operating system, or behaviors unique to iOS or Android. For coursework, responsive preview is sufficient; for final testing of real-world websites, testing on actual devices matters.

Well-designed websites look good at both narrow and wide widths. Poorly designed sites may show awkward layout, tiny text, or horizontal scrollbars at narrow widths. Every page you build in this course should be checked in responsive preview before you consider it complete.

Using Inspection to Learn and Debug

This final section brings together everything in the chapter and establishes the habit of using developer tools actively throughout your development work. Developer tools are not just for debugging broken pages — they are a learning environment. Every website you visit is an interactive lesson in web development.

When you see a visual effect, a layout pattern, or a behavior you want to understand, developer tools let you investigate it directly: select it with the element picker, read its HTML in the Elements panel, read its CSS in the Styles panel, try modifying styles live, and check how it adapts in responsive preview. This habit — inspect, read, experiment, understand — is how many experienced developers continue to learn.

An Inspection Routine

Check 1
Console
Any red errors? Missing files? Unexpected warnings?
Check 2
Elements
Select a heading, a paragraph, and a main content area. Does the HTML structure look like you intended?
Check 3
Styles
Select an element and confirm your CSS rules are being applied. Are any being overridden unexpectedly?
Check 4
Responsive Preview
Set the width to 375 pixels. Does the page look reasonable on a narrow screen?
Check 5
Network
Reload with the Network panel open. Did everything load with 200 or 304? Any 404 errors?

This routine does not take long, and it catches most problems before they accumulate. Beginning developers who skip it often end up with pages full of small problems that compound into larger confusion. Making it a habit early will pay off throughout the course.

Worked Example
Debugging a complete page with two bugs
  • The PageA "Learning Site" home page links a stylesheet at CSS/main.css and includes a <section> whose closing tag was mistakenly typed as <section> instead of </section>. The page loads unstyled, and the Elements panel does not match what was expected.
  • ConsoleOne red error: GET http://localhost/CSS/main.css net::ERR_FILE_NOT_FOUND. The path says CSS/main.css, but the folder is named css in lowercase. Web server paths are case-sensitive. Fix: change CSS/main.css to css/main.css.
  • ElementsThe browser tried to correct the unclosed <section> tag, producing unexpected structure in the DOM. Comparing the panel to the source code reveals the missing slash. Fix: change <section> to </section>.
  • StylesAfter fixing the CSS path, selecting the heading shows the expected rules applying correctly.
  • Responsive & NetworkAt 375 pixels the navigation stacks acceptably. After reloading, both the HTML and CSS files show status 200 — no errors remain.

Two bugs found, both fixed through systematic inspection — neither required guessing.

Goal

By the end of this chapter, opening developer tools and inspecting any element on any page should feel natural.

Chapter Summary

Key Terms

404 error
An HTTP error indicating a requested resource could not be found at the given path. Usually caused by a broken or incorrect file path.
browser engine
The software inside a browser that reads HTML, CSS, and JavaScript and renders them as a visible, interactive page. Examples: Blink, Gecko, WebKit.
Computed panel
The sub-panel showing final calculated values for every CSS property on the selected element, after all rules and inheritance are resolved.
console
The developer tools panel where browser errors, warnings, and JavaScript log messages appear. Accepts typed JavaScript input.
developer tools
A set of built-in browser panels for inspecting, editing, and debugging HTML, CSS, JavaScript, network requests, and performance.
DOM (Document Object Model)
The browser's internal, structured representation of a page's HTML, built from the source code and updated by JavaScript.
element picker
A developer tools feature that lets you click on any visible element in the browser viewport and jump to its corresponding code in the Elements panel.
Elements panel
The developer tools panel showing the page's DOM as an expandable tree, with CSS rules displayed alongside.
live editing
Modifying HTML or CSS directly in developer tools. Changes appear immediately but are not saved; refreshing resets all live edits.
Network panel
The developer tools panel showing all resource requests made while loading a page, including names, types, status codes, sizes, and load times.
page source
The raw HTML code of a web page as delivered by the server, before any JavaScript modifications.
responsive preview tool
A developer tools feature that simulates different screen sizes and devices by resizing the browser viewport. Also called Device Mode or Device Toolbar.
status code
A numeric code in an HTTP response indicating the outcome of a request. Common codes: 200, 304, 404, 500.
Styles panel
The sub-panel within the Elements panel showing all CSS rules applied to the selected element, including overridden and inherited rules.

Concept Check

Answer these questions before beginning the full review questions. They check basic understanding, not deep analysis.

  1. In your own words, what is the DOM, and how does it relate to a page's original HTML?
  2. Name the four developer tools panels introduced in this chapter and what each one shows.
  3. What does a struck-through CSS declaration in the Styles panel mean?
  4. What is the difference between an error and a warning in the Console?
  5. What does a 404 status code mean in the Network panel?
  6. Why should you check a page's layout at a narrow width, such as 375 pixels, even before studying responsive design formally?
PracticeCode Reading

Read each snippet and answer the questions. Reason through your answer before checking it in a browser.

Code Reading 4.1

<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <title>Practice Page</title> <link rel="stylesheet" href="styles/base.css"> <link rel="stylesheet" href="styles/layout.css"> </head> <body> <h1>Welcome</h1> <p>This is a practice page.</p> </body> </html>
  1. How many CSS files does this page link to?
  2. What paths will the browser use to look for those files?
  3. If both CSS files are missing, how many error messages would you expect in the Console?
  4. What would you see in the Network panel for each missing file?

Code Reading 4.2

▼ <body> ▼ <header> <h1>Course Home</h1> </header> ▼ <main> ▼ <section> <h2>Lessons</h2> <p>Choose a lesson below.</p> </section> ▼ <section> <h2>Resources</h2> <p>Additional materials.</p> </section> </main> ▼ <footer> <p>© 2025 Learning Site</p> </footer> </body>
  1. How many <section> elements are inside <main>?
  2. What heading level is used for each section title?
  3. What is inside the <footer> element?
  4. Is this the page source, or the DOM? What is the difference?

Code Reading 4.3

GET http://localhost/js/interactions.js net::ERR_FILE_NOT_FOUND GET http://localhost/images/hero.jpg net::ERR_FILE_NOT_FOUND
  1. How many files are missing?
  2. Where did the browser expect to find interactions.js? Where did it expect to find hero.jpg?
  3. What should the student check in their project folder to fix these errors?
  4. After fixing the paths, what status codes should appear in the Network panel?

Common Misconceptions

Misconception 1
"Viewing page source shows the complete current state of the page."
Page source shows the HTML as it was delivered from the server, before JavaScript ran. If JavaScript adds, removes, or modifies content after the page loads, those changes appear in the Elements panel but not in page source. For most simple HTML-and-CSS pages in the early chapters of this course, the difference is small. For pages that load data dynamically, the difference can be significant.
Misconception 2
"Changes made in developer tools are saved to the source files."
They are not. All live edits — to HTML in the Elements panel or CSS in the Styles panel — exist only in the browser's memory for the current session. Refreshing the page discards every live edit and reloads the original files. Developer tools changes are for exploration and testing only; permanent changes require editing the actual source files in your code editor.
Misconception 3
"The console is only for JavaScript errors."
The console reports more than JavaScript errors. It also shows network errors (missing files), browser warnings about accessibility and standards, security warnings, and deliberate log messages from JavaScript code. Beginners sometimes ignore the console because they are not studying JavaScript yet — this is a mistake. Missing CSS and image files both produce console errors.
Misconception 4
"If the page looks right, there are no errors."
A page can look acceptable and still have console errors, missing files that do not visibly affect the displayed content, accessibility problems that affect users with assistive technology, HTML structure mistakes the browser silently corrected, and broken paths that will matter later. Always check developer tools even when a page looks fine.
Misconception 5
"Developer tools work differently in every browser, so it is not worth learning them well."
Developer tools differ somewhat in appearance across Chrome, Firefox, Edge, and Safari, but the core panels and concepts are the same in all of them. Learning developer tools in one browser gives you skills that transfer directly to the others. The core panels — Elements, Console, Network, and responsive preview — exist in every major browser and work the same way.
ActivitiesDeveloper Tools in Practice

These activities require a browser with developer tools open. Use a simple informational website (a school, library, or small organization site) rather than a large commercial site, since those tend to be harder to read.

Inspection Practice

  1. Element picking. Activate the element picker. Click the page's main heading, a paragraph of body text, and a navigation link. For each, note the HTML element, its attributes, and write down the HTML you found.
  2. Styles inspection. Select a paragraph with the element picker. In the Styles panel, find the font size, the color value, and any margin or padding. Note any struck-through declarations and explain what they mean. Then check the Computed panel for the final font size in pixels.
  3. Console reading. Open the Console. Type document.title and press Enter. Then type 1 + 1, and then "hello" + " " + "world". Record what the console returns for each.
  4. Network panel audit. Open the Network panel and reload the page. Count the total number of requests, identify the status code of the HTML document request and any CSS requests, note any 404 errors, and identify the largest file that loaded.

CSS Debugging Practice

  1. A student links a stylesheet with <link rel="stylesheet" href="CSS/main.css">, but their project folder contains my-project/css/main.css in lowercase. The page loads unstyled. What is the problem? How would developer tools confirm it? Write the corrected <link> tag.
  2. A student inspects a heading and the Styles panel shows two rules: h1 { color: navy; font-size: 2rem; } and body h1 { color: #333333; font-size: 2.5rem; }, with the first rule's color: navy struck through. Which rule wins for color? Which wins for font size? What color and font size will the heading display?
  3. A student adds .main { background-color: red; } hoping to highlight their <main> element for testing, but the background does not change. Using what you know about the Styles panel, describe two things the student should check, and identify the most likely cause.

Console Reading Practice

For each message, explain what it means and what the developer should do.

GET http://localhost/fonts/OpenSans.woff2 net::ERR_FILE_NOT_FOUND
Uncaught ReferenceError: myFunction is not defined at HTMLButtonElement.onclick
[Violation] 'click' handler took 320ms
Warning: Consider adding a lang attribute to the html element

Responsive Preview Activity

  1. Comparing layouts at different widths. Open any news, school, or informational website. Set responsive preview to 375 pixels and observe the navigation, text size, and any overflow. Then try 768 pixels, then 1200 pixels. Write three to five sentences describing what you observed and which version looked best to you, and why.
  2. Finding a layout problem. Open a website you think might not be optimized for small screens. Set the width to 320 pixels. Look for horizontal scrolling, text too small to read, buttons too small to tap, or overlapping content. Identify and describe at least two problems.
ReviewReview Questions

Recall and Vocabulary

  1. What is the difference between viewing page source and using the Elements panel in developer tools? When would you prefer one over the other?
  2. What is the DOM? How does it differ from a page's original HTML source?
  3. What are the four most important developer tools panels introduced in this chapter? Briefly describe what each one is used for.
  4. What does a status code of 404 mean in the Network panel? What about 200?
  5. True or false: if you delete a line of CSS in the Styles panel, the change is permanent. Explain your answer.

Understanding and Explanation

  1. A student opens developer tools and sees a red error in the Console reading GET http://localhost/img/logo.png net::ERR_FILE_NOT_FOUND. What does this mean? What should the student do?
  2. Explain what the Styles panel shows. What does it mean when a CSS declaration appears with a strikethrough?
  3. What is the Computed panel, and how does it differ from the Styles panel?
  4. What does the responsive preview tool do? Why should you use it while building pages in this course, even before studying responsive design formally?
  5. Why is it a good habit to check developer tools even when a page looks correct in the browser?

Application and Analysis

  1. A student is working on a page and expects a heading to be green, but it appears black. They open the Styles panel and inspect the heading. Describe, in order, the steps they should take to diagnose the problem. Then describe the five-step inspection routine from Section 4.10 and explain why each check is useful.
Chapter 4 Checklist
Use this to confirm your understanding before moving to Chapter 5
Concepts
  • I can explain the difference between page source and the DOM.
  • I can explain what the Elements, Styles, Console, and Network panels show.
  • I can explain what a status code is and recognize common codes (200, 304, 404, 500).
  • I can explain why developer tools edits are not saved to source files.
Skills
  • I can open developer tools in my browser using a keyboard shortcut or menu.
  • I can use the element picker to find the HTML behind any visible part of a page.
  • I can inspect CSS rules in the Styles panel and identify overridden declarations.
  • I can read console messages and identify missing-file errors.
  • I can use the Network panel to confirm that files loaded successfully.
  • I can use responsive preview to test a page at different screen widths.
Study Habits
  • I run an inspection routine — Console, Elements, Styles, responsive preview, Network — after building or changing a page.
  • I use developer tools to study how real websites are built, not only to fix my own mistakes.
Preview — Chapter 5
HTML Documents and Page Structure

Chapter 4 gave you the tools to inspect and debug a page. Chapter 5 begins Part II of the textbook, where you will write your first complete HTML documents and learn the structure every web page is built on — elements, tags, attributes, nesting, indentation, the document type declaration, and the required skeleton that forms the foundation of every HTML file you write in this course. The developer tools you learned in Chapter 4 stay active throughout Part II: every time you write or modify a page, you will use the Elements panel to inspect your work, the Console to check for errors, and the Network panel to confirm linked files loaded correctly. The tools and the code develop together.

MGU Library Connection
  • Web Development: HTML, CSS, and JavaScript — Appendix J: Developer Tools and Debugging Reference
  • Web Development: HTML, CSS, and JavaScript — Appendix M: Glossary
  • Companion resource: Browser Developer Tools Guide
  • Companion resource: Web Debugging Checklist
  • Next chapter: Chapter 5 — HTML Documents and Page Structure (begins Part II)
  • MGU Computer Science Foundations — background reading on computation and problem solving