question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Positioning fails if <html> element have a `margin-top`

See original GitHub issue

Hello,

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:closed
  • Created 6 years ago
  • Comments:8 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
MaxArt2501commented, Jan 2, 2018

I honestly wasn’t aware that ads were that pesky 😕 Fortunately for you, you still have a chance of action setting the onOpen handler, 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).

0reactions
ryurancommented, Jan 2, 2018

😢 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.

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found