sodcalculator

10 Tech How-To

How to Inspect Elements in a Web Browser

Guide 10-45822 · Updated · Step by step

Inspecting elements lets you view and temporarily edit the HTML and CSS of any webpage directly in your browser. It’s the first tool web developers and curious users reach for when they want to see how a page is built, test design changes, or debug a layout issue. You don’t need any special software—just a modern browser like Chrome, Firefox, Edge, or Safari.

What You’ll Need

  • A desktop or laptop computer with a modern web browser (Chrome, Firefox, Edge, or Safari).
  • A webpage you want to inspect (any public site works).
  • Basic familiarity with right-clicking and using keyboard shortcuts.

Step-by-Step

  1. Open the webpage you want to inspect. Navigate to any site—your own or a public one. Inspecting works on all pages, but some sites may block right-click menus; if so, use the keyboard shortcuts in step 3.
  2. Right-click on the element you want to examine. Hover over text, an image, a button, or any part of the page. Right-click to open the context menu. Look for an option like Inspect, Inspect Element, or Examine Element—the wording varies by browser. Click it.
  3. Use a keyboard shortcut if right-click is blocked. In Chrome, Firefox, and Edge on Windows/Linux, press Ctrl+Shift+I to open DevTools directly. On Mac, use Cmd+Option+I. This opens the inspector panel without needing a right-click.
  4. Locate the element in the Elements (or Inspector) tab. The panel that opens will have several tabs: Elements, Console, Sources, Network, etc. The Elements tab (called Inspector in Firefox) is where the HTML structure appears as a collapsible tree. The element you right-clicked should be highlighted automatically.
  5. Understand the HTML tree. The tree shows parent and child elements. Click the arrows or triangles next to tags to expand or collapse sections. The highlighted line shows the selected element’s tag, classes, and attributes.
  6. View the CSS rules for the selected element. To the right of the HTML tree (or below it in some layouts) is the Styles pane. It lists all CSS rules that apply to the selected element, including those from external stylesheets and inline styles. You’ll see property-value pairs like color: red or font-size: 16px.
  7. Edit the HTML temporarily. Double-click any text within a tag (like a class name or the content between tags) to edit it. Press Enter to apply the change. The page updates instantly, but only for your current session. Refresh the page to revert to the original.
  8. Edit CSS values in real time. In the Styles pane, click on a property value (like 16px) and type a new value. Press Enter to see the change immediately. You can also click the checkbox next to a rule to disable it temporarily.
  9. Add a new CSS rule. In the Styles pane, click the + icon or the New Style Rule button. Type a property like background-color and a value like yellow. This adds a new rule to the element, letting you test changes without altering the original files.
  10. Use the element picker tool. In the DevTools panel’s top-left corner, there’s an icon that looks like a square with an arrow (or a mouse cursor). Click it, then hover over the page. The element under your cursor gets highlighted, and clicking it selects it in the HTML tree. This is useful when you can’t easily right-click.
  11. Close the inspector when done. Press Ctrl+Shift+I (or Cmd+Option+I on Mac) again, or click the X in the panel’s corner. Any changes you made disappear once you close or refresh the page—they’re never saved to the website itself.

Common Mistakes

  • Editing the wrong element. If you right-click near text but the highlighted element is a parent div, you might be editing the container, not the text itself. Use the element picker tool to select exactly what you want.
  • Forgetting changes are temporary. Many users think they’ve permanently changed the site. Refreshing the page undoes all edits.
  • Confusing HTML and CSS panes. The HTML tree shows structure; the Styles pane shows styling. Editing a tag name in the HTML won’t change its appearance unless CSS rules target that new name.
  • Closing the panel accidentally. Clicking outside the DevTools panel doesn’t close it—only the X or the shortcut does. If the panel disappears, you likely pressed the shortcut again.
  • Using Inspect on a locked-down page. Some sites (like banking portals) disable right-click or the DevTools shortcut. This is a security measure, not a bug.

Tips

  • Use the color picker. In the Styles pane, next to a color value, there’s a small color swatch. Click it to open a visual picker, which is faster than typing hex codes.
  • Toggle device mode. In Chrome, click the device icon (a rectangle with a phone outline) to see how the page looks on mobile. This is great for testing responsive design.
  • Copy the element’s selector. Right-click an element in the HTML tree, choose Copy > Copy selector. This gives you a CSS selector you can use in your own stylesheet.
  • Use the console alongside. The Console tab lets you run JavaScript. For example, type document.querySelector('h1').style.color = 'blue' to change all h1s to blue. This is more advanced but powerful.
  • Learn the shortcut for the picker. Press Ctrl+Shift+C (or Cmd+Shift+C on Mac) to activate the element picker directly without clicking the icon.
  • Take screenshots. In the DevTools, you can capture a screenshot of the full page (including parts below the fold) via the three-dot menu > Capture full size screenshot.

Troubleshooting

  • Right-click does nothing. Some sites override the context menu. Use Ctrl+Shift+I (or Cmd+Option+I) to open DevTools, then use the element picker icon to select the element you want.
  • The Elements tab is empty. If you see a blank tree, you might be on a page that hasn’t fully loaded, or the DevTools opened in a separate window. Try refreshing the page while DevTools is open.
  • Changes don’t show up. If you edit CSS but the page doesn’t change, check that the rule isn’t overridden by a more specific rule. Look for a strikethrough on the property—that means another rule is winning. Try adding !important to your test rule (e.g., color: red !important;) to see if that’s the issue.
  • DevTools won’t open. On some corporate-managed devices, IT may disable DevTools. Try using a different browser or a portable version. If that’s not possible, you can’t inspect on that machine.
  • The panel is too small. Drag the edge of the DevTools panel to resize it. You can also dock it to the bottom, side, or as a separate window using the three-dot menu.
  • You can’t find the Styles pane. In Firefox, the CSS rules are in the right sidebar of the Inspector tab. If it’s hidden, click the “Rules” tab at the top of the sidebar. In Chrome, the Styles pane is always visible on the right side of the Elements tab.

Frequently Asked Questions

Is inspecting elements illegal?

No. Inspecting elements is a standard browser feature used for development and debugging. It only shows you the code that the site already sent to your browser. You’re not hacking or bypassing anything.

Can I permanently change a website’s content with inspect?

No. All changes are local to your browser session and disappear when you refresh or close the page. To permanently change a site, you’d need to edit the actual files on the server, which requires access and permission.

Why does the CSS show properties I didn’t write?

Browsers apply default styles (like margin or font-size) to elements. Also, frameworks like Bootstrap or WordPress themes add their own CSS. The Styles pane shows the final computed result, including inherited and default rules.

How do I copy the HTML of an element?

Right-click the element in the HTML tree, choose Copy > Copy outerHTML. This copies the full tag with its attributes and content. You can paste it into a text editor or your own project.

Does inspect work on mobile browsers?

Most mobile browsers don’t have a built-in inspect feature. However, you can connect your phone to a computer and use desktop DevTools to inspect mobile pages via remote debugging (requires USB connection and developer mode).

Why do some sites block right-click?

Some sites try to prevent copying content or images. However, the keyboard shortcut Ctrl+Shift+I usually still works. If it doesn’t, the site may have disabled DevTools entirely, which is rare but possible.

Related

General steps for current mainstream versions; menus can differ by device and version. See the disclaimer or report an error.

More in this bed

The whole Tech How-To bed →