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.

Highlight drawn incorrectly when body margins are 0

See original GitHub issue

I created a little landmarks test page, which I want to completely fill the browser’s height and width without scrolling. When I set CSS margin for body to 0;

  • the highlight border box is drawn a bit too small on the right (except for the nav)
  • the nav’s highlight title is drawn too far to the right (the other highlight titles are drawn in the correct place)

To see the difference between correct highlighting and incorrect highlighting, first run the example and use <kbd>Alt + Shift + N</kbd> (Windows) to move through the landmarks. Note that the highlights are drawn a little bit off:

image

Now open DevTools (I’m using Chrome, but saw this in Firefox as well) and uncheck the body style for margin: 0;. The body inherits an 8px margin from the browser’s style sheet, which causes an annoying vertical scrollbar, but the highlights are ok:

image

Issue Analytics

  • State:open
  • Created 3 years ago
  • Comments:15 (8 by maintainers)

github_iconTop GitHub Comments

1reaction
matatkcommented, Dec 1, 2020

Thanks for the helpful debugging @carmacleod. I’ll look into it soon. (As it happens, I hadn’t recieved notification of this when you reported it, sorry for the laggy reply.)

Read more comments on GitHub >

github_iconTop Results From Across the Web

CSS Margin: 0 is not setting to 0 - Stack Overflow
I'm a new comer to web designing. I created my web page layout using CSS and HTML as below. The problem is even...
Read more >
margin - CSS: Cascading Style Sheets - MDN Web Docs
The margin CSS shorthand property sets the margin area on all four sides of an element.
Read more >
Align text or adjust the margins within a text box
Click the outer edge of the text box to select it. · On the Shape Format tab, click Format Pane. · Click the...
Read more >
Can you help me solve this problem? : r/css - Reddit
margin : 0.5em auto; display: block; height: auto; ... @media screen { body { margin: 0; padding: 0; -webkit-user-select: none; overflow-x: ...
Read more >
8 Box model - W3C
If the margin has 0 width, the margin edge is the same as the border edge. ... body { margin: 2em } /*...
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