Positioning fails if <html> element have a `margin-top`
See original GitHub issueHello,
Yes, I know, a margin on <html> element seems awful.
But in my case a advertisement do it, I can’t fix it.
So this function fail to return real position of the root element. https://github.com/MaxArt2501/share-this/blob/master/src/dom.js#L1-L6
Issue Analytics
- State:
- Created 6 years ago
- Comments:8 (4 by maintainers)
Top Results From Across the Web
Margin-top not working [duplicate] - Stack Overflow
It's called margin collapse. It happens when one block element is the child of another block element. here are a couple of methods...
Read more >margin-top - CSS: Cascading Style Sheets - MDN Web Docs
The margin-top CSS property sets the margin area on the top of an element. A positive value places it farther from its neighbors, ......
Read more >Ultimate Guide to non-working CSS margins - Cmichel.io
Sometimes you're styling some HTML elements with CSS and there seems to be a margin between the elements that you never defined.
Read more >HTML DOM Style marginTop Property - W3Schools
The marginTop property sets or returns the top margin of an element. Both the margin property and the padding property insert space around...
Read more >CSS static and relative positioning - W3C Wiki
For boxes in the normal flow, ie boxes that aren't floated or absolutely positioned, the vertical margins between two adjacent block boxes will...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found

I honestly wasn’t aware that ads were that pesky 😕 Fortunately for you, you still have a chance of action setting the
onOpenhandler, which gets called every time the popover is opened, and gives you a reference to the popover’s element. Then you can set its top margin at runtime (which is also better, as you can’t be sure if that margin is there or not, so you can check right before).😢 this margin on
<html>is added by an advertissement, not on every page and not if ab are blocked. It is really not easy to know when we have the margin or not. I need to check it when the popover appear.I will try it.