How to Inspect Pages Using DevTools

WBOY
Release: 2024-08-19 20:31:50
Original
415 people have browsed it

Earlier, we talked about the DOM (Document Object Model).

How to Inspect Pages Using DevTools

I told you that when the browser reads the HTML document that is returned from the server, it constructs a Document Object Model. Now, let me show you this Document Object Model in action.

How to Inspect Pages Using DevTools

Once again, we are going to use Chrome DevTools.

Next: Best Front-end Frameworks For Web Development

So let's open up DevTools.

How to Inspect Pages Using DevTools

In this section, we are going to look at the elements tab.

What we have here on the left side is our Document Object Model.

How to Inspect Pages Using DevTools

These are the same elements we created earlier in the tutorial.

We have the HTML element, the HEAD, the BODY, and so on. But, we have some additional elements that are injected by Live Server:

How to Inspect Pages Using DevTools

Don't worry about these. These are purely used by Live Server, so it automatically reloads our page.

Now, we can hover over any of these elements, and you can see the elements highlighted on the screen.

How to Inspect Pages Using DevTools

We can click on an element, and on the right side, we can see the styles applied to this element.

How to Inspect Pages Using DevTools

So, we get these styles that are defined for the image element. WIDTH, BORDER-RADIUS, and so on.

We can enable or disable these styles.

How to Inspect Pages Using DevTools

For example, we can disable the WIDTH property, and now, our image is big.

How to Inspect Pages Using DevTools

Then we can bring it back.

How to Inspect Pages Using DevTools

We can also change its value. So we can set it to, let's say, 50px. Now, our image is smaller.

How to Inspect Pages Using DevTools

A lot of front end developers play with these styles to get the specific look they want. Once they figure out the exact styles and their values, then they apply them to the code.

Now, one more thing.

How to Inspect Pages Using DevTools

Over here, we can see where these styles have been applied.

So, in index.html on line 6, we can click on this link which takes us to the exact line of code where we wrote that style.

How to Inspect Pages Using DevTools

Now, we are currently on the Sources tab.

On the Sources tab

We can go back to Elements tab and inspect other elements as well.

How to Inspect Pages Using DevTools

So, this is the basics of inspecting elements using DevTools. We are going to talk about this in more detail in the future.

Happy coding!
Karl

The above is the detailed content of How to Inspect Pages Using DevTools. For more information, please follow other related articles on the PHP Chinese website!

source:dev.to
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!