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.

Margin inconsistently added to code-toolbar's `div` on Prism's site

See original GitHub issue

Information:

  • Prism version: Latest
  • Plugins: Autoloader, Toolbar, Show Language
  • Environment: Browser? Prism’s site?

Description Toolbar adds some margin to its own div element on Prism’s site, and it does so in a strange manner. For some code blocks it’s margin: 8px 0px;, for others it’s margin: 0px;. I have no idea why. (Screenshots below are from Chrome)

image

image

Example You can check out #3104 yourself (though it’s a little inconvenient), where I am writing some docs on Prism tokens. This can also be seen on the Toolbar, Show Language, and Copy to Clipboard plugin pages, if you open dev tools.

Extra info

  • I can say with certainty that the Toolbar plugin is part of the problem, because when I commented it out, the problem went away.
  • The behaviour exhibited in Firefox is also different from the behaviour exhibited in Chrome (in Firefox, the style is applied to the pre element instead of the div, but they all get style: 0px; instead of a mix), so that’s another thing to look out for.

I don’t know if this is a problem specific to Prism’s website, and/or if there are any other elements at play. I’ll poke around more and see what else I can find. Additional help will be appreciated!

Originally discovered here: https://github.com/PrismJS/prism/pull/3104#issuecomment-932996123

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:12 (12 by maintainers)

github_iconTop GitHub Comments

1reaction
hoonweitingcommented, Oct 11, 2021

Aw man, you’re amazing!

1reaction
RunDevelopmentcommented, Oct 10, 2021

it’s the only way users can ‘preview’ the theme.

That’s a very good point.

I made a PR (#3146) to fix the root cause of all of this: The theme selector’s design.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Adding margin to div pushes it off the screen - Stack Overflow
Divs pushed off screen on bottom and no margin in-between divs. 5px margin on top, left, and right is present. resulting page. I...
Read more >
How To Adjust the Content, Padding, Border, and Margins of ...
You'll start by creating a <div> element that contains text content and then adjust the values of each of these boxes to help...
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. ... <div class="center">This element is centered.
Read more >
CSS Margin - W3Schools
With CSS, you have full control over the margins. There are properties for setting the margin for each side of an element (top,...
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