Closed
Description
Describe the bug
The script appears to set padding:0 in a <style> tag, meaning I can't override this is the css (as in example in the readme)
<style type="text/css">
.hljs-ln{border-collapse:collapse}
.hljs-ln td{padding:0}
.hljs-ln-n:before{content:attr(data-line-number)}
</style>
To Reproduce
Expected behavior
able to style the padding.
Screenshots
If applicable, add screenshots to help explain your problem.
Desktop (please complete the following information):
- Chrome
- Latest
Smartphone (please complete the following information):
- Device:Desktop Windows 10 PC
Additional context
Add any other context about the problem here.
Metadata
Metadata
Assignees
Labels
No labels
Projects
Milestone
Relationships
Development
No branches or pull requests
Activity
wcoder commentedon Dec 12, 2018
Hi @rmawatson thank you for feedback!
Currently, this plugin injects default styles in the
<head>
of the page after init.workaround
You can override default styles if put it after plugin
<script>
declaration.See an example: https://jsbin.com/wupayip/edit?html,output
rmawatson commentedon Dec 12, 2018
right, yes, but your example with padding-right in the readme is wrong. Due to your padding in the style tag above you cannot set padding-right here. Try in your example code, you will see it makes no difference
It does however work if you change this to,
padding-right: 5px !important;
littlefinger42 commentedon Dec 18, 2018
This is due to CSS specificity. Learn more about CSS specificity on MDN here.
If you attach your
padding-right: 5px;
to a more specific selector than it is set in the base HLJS styling, it will be applied. A more specific selector could be:.hljs-ln td.hljs-ln-numbers { padding-right: 5px; }
rmawatson commentedon Dec 18, 2018
I know whats it due too... I am pointing out that the example in the readme with this project is wrong.
wcoder commentedon Dec 18, 2018
Hi there, thanks for contributing!