UNPKG

1.55 kBCSSView Raw
1pre[data-line] {
2 position: relative;
3 padding: 1em 0 1em 3em;
4}
5
6.line-highlight {
7 position: absolute;
8 left: 0;
9 right: 0;
10 padding: inherit 0;
11 margin-top: 1em; /* Same as .prism’s padding-top */
12
13 background: hsla(24, 20%, 50%,.08);
14 background: linear-gradient(to right, hsla(24, 20%, 50%,.1) 70%, hsla(24, 20%, 50%,0));
15
16 pointer-events: none;
17
18 line-height: inherit;
19 white-space: pre;
20}
21
22@media print {
23 .line-highlight {
24 /*
25 * This will prevent browsers from replacing the background color with white.
26 * It's necessary because the element is layered on top of the displayed code.
27 */
28 -webkit-print-color-adjust: exact;
29 color-adjust: exact;
30 }
31}
32
33 .line-highlight:before,
34 .line-highlight[data-end]:after {
35 content: attr(data-start);
36 position: absolute;
37 top: .4em;
38 left: .6em;
39 min-width: 1em;
40 padding: 0 .5em;
41 background-color: hsla(24, 20%, 50%,.4);
42 color: hsl(24, 20%, 95%);
43 font: bold 65%/1.5 sans-serif;
44 text-align: center;
45 vertical-align: .3em;
46 border-radius: 999px;
47 text-shadow: none;
48 box-shadow: 0 1px white;
49 }
50
51 .line-highlight[data-end]:after {
52 content: attr(data-end);
53 top: auto;
54 bottom: .4em;
55 }
56
57.line-numbers .line-highlight:before,
58.line-numbers .line-highlight:after {
59 content: none;
60}
61
62pre[id].linkable-line-numbers span.line-numbers-rows {
63 pointer-events: all;
64}
65pre[id].linkable-line-numbers span.line-numbers-rows > span:before {
66 cursor: pointer;
67}
68pre[id].linkable-line-numbers span.line-numbers-rows > span:hover:before {
69 background-color: rgba(128, 128, 128, .2);
70}