Chrome Developer Tools – Easy Web Debugging You Need to Know
Tags: howto, chromedevelopercon, chromedevelopertoo, chromeinspecteleme
Published: 2018-12-12 12:54:48

---
title: Chrome Developer Tools – Easy Web Debugging You Need to Know
published: true
tags: How To,Chrome Developer Con,chrome developer too,chrome inspect eleme
canonical_url: https://dirkstrauss.com/chrome-developer-tools-easy-web-debugging/
---

Chrome Developer Tools – As a web developer, one tool that is invaluable is the Chrome Developer Tools. It is a feature rich set of tools that you can use directly from your Chrome Browser. In this article, I will have a look at four Chrome Developer Tools in particular.

## Chrome Developer Tools

Creating web applications pose specific challenges for developers. It isn’t always possible to stick to pure C# debugging in Visual Studio, especially when you are creating a responsive UI. The project below uses [SASS](https://amzn.to/2U9GJ0a) that compiles to [CSS](https://amzn.to/2SpB8kJ). To open the Chrome Developer Tools, you obviously need to be using Chrome as your browser. Right click anywhere on your web page (or on an element) and select the **Inspect** menu option in your context menu. You can also hold down **Ctrl+Shift+I**. You can [download the code from my GitHub repository](https://github.com/dirkstrauss/ChromeDevToolsDemo) if you want to follow along.

### Looking for something else? Try these links instead:

- [Chrome Dev Tools – More Advanced Tips for Better Debugging](https://dirkstrauss.com/chrome-dev-tools-advanced-debugging-tips/)
- [Sass CSS – This Awesome Tool Will Make You Sassy](https://dirkstrauss.com/sass-css-sassy-websites)
- [The Unbelievably Powerful Multi Select. Increase Productivity Now](https://dirkstrauss.com/the-unbelievably-powerful-multi-select/)
- [Windows Task Manager – Resolve High Disk Usage](https://dirkstrauss.com/windows-task-manager/)
- [Resizing VirtualBox Disks Does Not Work With Snapshots](https://dirkstrauss.com/resizing-virtualbox-disks/)

## 1. Drag and Drop Elements

Did you know that you can select specific elements on your web page and drag them around to see what they look like in different positions on the web page you are creating? Simply click and hold the element and drag it to a new position.

![Drag and drop elements](https://i0.wp.com/dirkstrauss.com/wp-content/uploads/2018/12/drag_drop_elements.gif?resize=640%2C428&ssl=1)

This is really great if you want to move things around a bit without having to go back to Visual Studio and changing the markup there. As a side note, if you have not looked at what SASS has to offer, [I encourage you to do so](https://sass-lang.com/). It has really changed my life (I know it sounds really geeky) and now [I can’t imagine working without SASS](https://dirkstrauss.com/sass-css-sassy-websites).

## 2. Adding CSS

Another nice trick is to add CSS to your elements right in the inspector. Chrome Developer Tools makes this really easy by allowing you to select your element and click on the plus icon. You can then add a specific CSS property to your element.

![Adding CSS to an Element](https://i0.wp.com/dirkstrauss.com/wp-content/uploads/2018/12/add_css.gif?resize=640%2C428&ssl=1)

This allows you to get a feel for what your element will look like if you add specific CSS properties to it.

## 3. Adding a Class

In my project, I have a new class called redButton. All it does is sets the background color to red. To see how an element is affected when applying the class to it, select the element and click on the **.cls** toggle. As you type, the class is found and when you hit **Enter** , the class is applied. This will style the element immediately. Furthermore, you can then hover over the class name added in the **Styles** window, hold down **Ctrl+Click** and go to the file that contains the class you added. Hovering over the tab will show you the location of the file in your project.

![Adding a class to css](https://i2.wp.com/dirkstrauss.com/wp-content/uploads/2018/12/add_class.gif?resize=640%2C428&ssl=1)

If you need to make changes to the class, you can use this method to easily find the containing file.

## 4. Triggering State

A particular tricky thing to do is mimic states. Chrome Developer Tools allows you to trigger the state of an element. In this example we are triggering the hover state of a button. We can then change the CSS as needed to see what effect the changes have on the hover state (for example) .

![Triggering State](https://i1.wp.com/dirkstrauss.com/wp-content/uploads/2018/12/trigger_state.gif?resize=640%2C428&ssl=1)

You can easily modify element states without having to blindly change the CSS and hope that it is applied correctly.

## Wrapping up

Chrome Developer Tools give web developers a host of options for debugging the UI. When you use these these tools in conjunction with each other, you can easily change elements styles on the fly.

For mre on this topic, check out [my second article on Chrome Developer Tools](https://dirkstrauss.com/chrome-dev-tools-advanced-debugging-tips/) that goes a little more in depth.

The post [Chrome Developer Tools – Easy Web Debugging You Need to Know](https://dirkstrauss.com/chrome-developer-tools-easy-web-debugging/) appeared first on [Programming and Tech Blog](https://dirkstrauss.com).