03-Developer Tools and Debugging
03-Developer Tools and Debugging
● You learned about chrome developer tools. Many modern browsers that you
see today have developer tools built into them, these are called browser
developer tools. They all work in a similar way. For example Mozilla Firefox,
Microsoft Edge, Brave, etc.
● These are powerful tools for web developers for a variety of purposes.
● They help you understand a web page structure (basic HTML), and styling
(CSS) of various elements by inspecting them.
● They help in modifying the HTML and CSS of the page to experiment with
the looks of the webpage for trial purposes.
● They help in debugging code.
Note: They also help you understand the javascript code and functionality
associated with it. You’ll learn more about this in the upcoming lectures.
Debugging
Let’s say you have a simple web page as shown below. The text color of the list
items is blue. But you coded it to be green. Now you wish to understand why it is
appearing blue while you coded it to be green. Here we have used Microsoft Edge
as our browser. Similarly, you can use developer tools in other browsers as well.
● Step 1: Select the HTML element that you want to fix, then right-click and
select “inspect”
● Step 2: Under ‘Elements’ you’ll be able to see the HTML code highlighted
with respect to the HTML element that you selected to inspect. Here one
<li>..</li> is selected. You can click on it to expand and see its contents.
Below you can see ‘Styles’ where you’ll be able to see all the styles applied to
the selected element.
- In Step 3, you can see some styles have strikethroughs. For example in
<ul>, color: green;
This means you coded <ul> contents to have the color green, but the
browser didn’t apply this color, since some other more specific styling
(that is applied to <li>) overrode this value. Hence developer tools help
us figure out such scenarios helping in debugging.
Note:
You don’t have to master using Browser Developer tools in one go. As you keep
practising you’ll learn with time.
In general, if you ever face any issues with Chrome Developer Tools or if you want to
learn more, you can refer to its documentation whenever required.
● Documentation
● MDN Article on Chrome Dev Tools