How to Inspect an element that only appears when I do Hover on another element?

Asked

Viewed 496 times

4

I have an element that when making a hover in it will appear a pseudo-element elsewhere on the screen, however I would like to inspect this pseudo-element when it is visible on the screen.

How do I inspect an element that only appears when the other is with hover?

Look at this simple example

button {
  position: relative;
}
button::after {
  content: "";
  display: inline-block;
  margin-left: 150px;
  background-color: red;
  position: absolute;
}
button:hover::after {
  content: "aqui!";
}
<button>button</button>

1 answer

8


Follow the steps:

  1. Click on the element you need to give the hover and Inspecione element in it.

  2. In HTML check that this element is selected and you will see on the right an item :hov

  3. Click on :hov and select :hover.

Ready just inspect the element that appeared on the screen and no longer comes out.

inserir a descrição da imagem aqui

To the Firefox, instead of the button :hov there is the icon inserir a descrição da imagem aqui title "Toggle pseudo-classes".

  • 6

    I created a GIF with the steps you mentioned, I think it is more didactic than a static image. If you disagree, you can reverse the editing smoothly :D

  • 1

    @Andersoncarloswoss So by gif you already deserve half the score :D

  • That’s right, thank you!

  • @Andersoncarloswoss excellent edition! It became very good and didactic for all consult vlw!

Browser other questions tagged

You are not signed in. Login or sign up in order to post.