Ask Scotland Yard

Elements tab

Share This Post

Inspector…no, I do not really mean the Scotland Yard type, but rather a code inspector. Today’s modern browsers all have built in inspectors. As a web developer, it is crucial that this be a part of your toolbox. In fact, they have become so common place that many forums have the expectation that you have already inspected your code prior to asking the question.

So what are they? How do they work? Well, since I do not want this post to become a dissertation, I will focus on a single browser, Chrome. It has become my personal favorite over the years as I find the ease of use intuitive for me. That does not disparage the other browsers. You may appreciate one of the other ones out there more so than Chrome. That is fine. The topics I will cover exist in all modern browsers, they just might have a slightly different interface of shortcut to get to them, etc. So let’s dive into some of the inspector tabs and tools…

Opening the Inspector

These may differ between browsers, but typically there are various ways to get to the inspector…

  • Through the file menu (or pancake menu in the case of Chrome). Then it is typically called ‘Developer Tools’ or the like.
  • Right-clicking a page and selecting ‘Inspect Element’. This has the advantage of not only opening the inspector, but taking you to the position in the code where the element you clicked upon exists.
  • Shortcut keys…
    • F12 – opens up the inspector on the console tab…so does CTRL-Shift-J
    • CTRL-Shift-I – opens the inspector on the elements tab

Inspector Opened…so now what?

Elements Tab

The elements tab displays your HTML. It is interactive in that you can expand or contract elements. You can add, delete or alter attributes. This is not permanent…just in your view. You have to still alter the original file. The main screen will highlight the elements in the page as you scroll over them so you can visually see where you are on the page. 

There is also a CSS listing on this tab. You can add, remove or alter css rules here to see the effects. You can even see how the css rules are computed for inheritance. You can also look at pseudo classes, such as hover.

Elements tab

Network Tab

The network tab is where you will find each network request. Every item on the page is displayed and shows how it was retrieved, how long it took and more. I find this tab invaluable for two major aspects…performance and Ajax functionality. 

Performance…if I find my app is not performing how I like, I can see how long each request took and then take action on the offender, since I will know which request(s) took the longest.

Ajax…I can watch each Ajax request and even click on it to see the server response. This is especially helpful in debugging Ajax.

Network Tab

Sources Tab

I utilize the sources tab for a lot of JavaScript debugging. It is on this tab where you can set break point (even conditional ones). You can implement watch expressions and see your variables change throughout your program’s lifespan.

Sources Tab

Console Tab

The console tab is another one I use constantly. This screen displays any errors or warnings that the program produces. So I also utilize this tab while debugging. Additionally, you can write JavaScript code directly into the console and have the Chrome V8 JavaScript engine interpret it. Plus, you can write to the console from your JavaScript code with the console.log method. The more you develop, the more you will utilize this tab.

Console Log Tab

So there you have it…a few of the items at your disposal within the inspector. Now, I have just scratched the surface. There is a lot more to the inspector, such as a mobile emulator, add-ons that can be added to the inspector and more. I would encourage you to make use of it extensively and get to know the tools. You will find it saves you a lot of time and headache when coding and debugging.

 

Happy Coding!

Clay Hess

More To Explore

Code

Demystifying Scrum User Stories Confirmation: Ensuring Quality and Collaboration

One of the key elements of Scrum is the use of user stories to define the requirements of a system or feature from the perspective of the end user. As teams work through the product backlog, it becomes crucial to confirm the user stories to ensure they meet the desired criteria and are ready for development. In this blog post, we’ll explore the concept of Scrum user stories confirmation and its significance in delivering high-quality products.

Code

The Power of Conversations in Scrum User Stories

At the heart of Scrum lies the concept of user stories, which serve as a means of capturing requirements from the perspective of end-users. However, the true power of user stories lies not just in their written form but also in the conversations that take place around them. In this blog post, we will explore the significance of conversations in Scrum user stories and how they contribute to the success of Agile projects.

Do You Want To Boost Your Business?

drop us a line and keep in touch

Scroll to Top
small_c_popup.png

Need help?

Let's have a chat...


Login

Jump Back In!

Here at Webolution Designs, we love to learn. This includes sharing things we have learned with you. 

Register

Begin Your Learning Journey Today!

Come back inside to continue your learning journey.