D
D
Dark Hole2016-02-12 15:04:45
css
Dark Hole, 2016-02-12 15:04:45

Why does img count coordinates from the "father" of its div?

Sounds crazy. But in order like this:
In fact, I rivet a site for myself and suddenly img with an empty src and absolute "jumps" from its block.
The eyes popped out of their sockets.
But... okay. I put down top: -50px; (before that it was only absolute, without left, right, top and bottom).
Now the element goes completely crazy and jumps as much as 100px, safely jumping over the place intended for it.
I'm at a loss.
And I push him top: 0px;
Then everything became clear: he counts his coordinates not from "dad", but from "grandfather".
Nearby (older through the element) there was another same img. Threw it there and safely forgot about the problem.
But still wondering what it was?
UPD: It turned out that auto positions as a floated element

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
Anton Fedoryan, 2016-02-12
@AnnTHony

Read how it all works first.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question