This is a brief workshop developed for Ritu Ghiya's Class, ART 753 Collage Poetics, in the Graphic Design Department, Yale School of Art.
This workshop has been designed to provide an overview of the browser developer tools for participants. The program is divided into two sections, each serving a distinct purpose. The first section will provide a brief introduction to the tools and their functions, while the second section will comprise a series of exercises aimed at helping participants learn how to use the tools to debug and inspect web pages.
The developer tools are a set of web authoring and debugging tools built into most modern browsers. The tools allow web developers to inspect and edit the HTML, CSS, and JavaScript on any web page. The tools also allow developers to debug JavaScript code and to profile the performance of web pages.
The developer tools can be opened in most modern browsers by pressing F12
or Ctrl+Shift+I
(or Cmd+Opt+I
on Mac). The tools will open in a separate window. The tools can also be opened by right clicking on any web page and selecting Inspect Element
from the context menu.
The developer tools window is comprised of three key sections: the toolbar, the sidebar, and the main panel. The toolbar provides buttons to switch between tools, while the sidebar lists tools that can be opened in the main panel. The main panel displays the currently selected tool. For this workshop, we will focus on the following tools:
- The Elements tool
- The Console tool
- The Sources tool
The Elements tool allows inspection and modification of a web page's HTML and CSS. The tool is divided into two sections: the markup view, which displays the HTML of the selected element, and the styles view, which displays the CSS styles applied to the selected element.
The Console tool provides the ability to execute JavaScript code and view the code's output. The Console tool is separated into the command line for entering code and the output section for displaying results.
The Sources tool enables inspection and editing of a web page's JavaScript code. It has three main components: the file tree, which displays loaded JavaScript files, the editor for modifying code, and the debugger for setting breakpoints and stepping through the code.
- Open the developer tools by pressing
F12
orCtrl+Shift+I
(orCmd+Opt+I
on Mac). - Select the Elements tool from the toolbar.
- Load a web page in the browser that you would like to inspect.
- Use the "Elements" tool to inspect the HTML and CSS of the web page.
- In the "Markup" view, click on different elements on the page to see their HTML structure.
- In the "Styles" view, see the CSS styles applied to the selected element.
- Experiment with modifying the HTML and CSS using the "Elements" tool to see the changes in real-time on the web page.
- Save your changes by right-clicking the page and selecting "Save as...", or refresh the page to discard the changes.
- Open the developer tools by pressing
F12
orCtrl+Shift+I
(orCmd+Opt+I
on Mac). - Go to the "Console" tool.
- Load a web page that has JavaScript.
- Use the "Console" tool to execute JavaScript code.
- Try some simple JavaScript commands like
[...document.querySelectorAll("a")].forEach(a => a.style.color = "hotpink");
. - Use the "Console" tool to debug JavaScript code.
- Observe the output of the code in the "Output" section.
- Open the developer tools by pressing
F12
orCtrl+Shift+I
(orCmd+Opt+I
on Mac). - Go to the "Sources" tool.
- Find and select the JavaScript file you want to debug from the file tree on the left side.
- Set a breakpoint by clicking on the line number where you want to pause the execution of the code.
- Refresh the web page to trigger the JavaScript code.
- The code execution will stop at the breakpoint you set, and you can inspect the values of variables and the call stack in the "Scope" section.
- You can step through the code using the "Step over" and "Step into" buttons, or by using the keyboard shortcuts
F10
(step over) andF11
(step into). - When you have finished debugging, you can resume the code execution by clicking the "Resume" button or using the keyboard shortcut
F8
. - You can also make changes to the code in the editor and see the results in real-time by hitting "Save" or Ctrl+S (or
Cmd+S
on Mac).
- 21+ Browser Dev Tools & Tips You Need To Know
- Debugging JavaScript - Chrome DevTools 101
- DevTools Tip
- Chrome DevTools for designers