pico/scss/content/_code.scss

92 lines
1.6 KiB
SCSS
Raw Normal View History

2019-11-27 15:31:49 +07:00
/**
* Code
*/
// Reboot based on :
// - normalize.css v8.0.1 | MIT License | github.com/necolas/normalize.css
// - sanitize.css v12.0.1 | CC0 1.0 Universal | github.com/csstools/sanitize.css
2019-11-27 15:31:49 +07:00
//
// 1. Correct the inheritance and scaling of font size in all browsers
// 2. Correct the font sizing in all browsers
2019-11-27 15:31:49 +07:00
pre,
code,
kbd,
samp {
2021-11-02 02:54:52 +07:00
font-family: var(--font-family); // 1
2021-11-08 00:12:34 +07:00
font-size: 0.875em; // 2
2019-11-27 15:31:49 +07:00
}
// Prevent overflow of the container in all browsers (opinionated)
pre {
-ms-overflow-style: scrollbar;
overflow: auto;
}
2019-11-27 15:31:49 +07:00
// Pico
//
pre,
code,
kbd {
2021-10-23 18:27:19 +07:00
background: var(--code-background-color);
2021-07-02 16:54:41 +07:00
color: var(--code-color);
font-weight: var(--font-weight);
line-height: initial;
2021-11-08 00:12:34 +07:00
border-radius: var(--border-radius);
2021-10-23 17:28:31 +07:00
}
2019-11-27 15:31:49 +07:00
code,
kbd {
display: inline-block;
2021-10-24 12:33:20 +07:00
padding: 0.375rem 0.5rem;
2019-11-27 15:31:49 +07:00
}
pre {
display: block;
2021-07-02 16:54:41 +07:00
margin-bottom: var(--spacing);
2019-11-27 15:31:49 +07:00
overflow-x: auto;
> code {
2021-11-08 00:12:34 +07:00
background: transparent;
2019-11-27 15:31:49 +07:00
display: block;
2021-10-23 17:28:31 +07:00
padding: var(--spacing);
2019-11-27 15:31:49 +07:00
font-size: 14px;
2020-09-29 08:38:35 +07:00
line-height: var(--line-height);
2019-11-27 15:31:49 +07:00
}
}
2021-07-02 16:54:41 +07:00
// Code Syntax
2019-11-27 15:31:49 +07:00
code {
// Tags
b {
2021-07-02 16:54:41 +07:00
color: var(--code-tag-color);
font-weight: var(--font-weight);
2019-11-27 15:31:49 +07:00
}
// Properties
i {
2021-07-02 16:54:41 +07:00
color: var(--code-property-color);
2019-11-27 15:31:49 +07:00
font-style: normal;
}
// Values
u {
2021-07-02 16:54:41 +07:00
color: var(--code-value-color);
2019-11-27 15:31:49 +07:00
text-decoration: none;
}
// Comments
em {
2021-07-02 16:54:41 +07:00
color: var(--code-comment-color);
font-style: normal;
}
2019-11-27 15:31:49 +07:00
}
// kbd
kbd {
2021-07-02 16:54:41 +07:00
background-color: var(--code-kbd-background-color);
color: var(--code-kbd-color);
vertical-align: middle;
2019-11-27 15:31:49 +07:00
}