picocss/scss/content/_code.scss

69 lines
1.5 KiB
SCSS
Raw Normal View History

2022-10-23 10:47:50 +07:00
@use "sass:map";
2022-10-22 13:11:51 +07:00
@use "../settings" as *;
2022-10-23 10:47:50 +07:00
@if map.get($modules, "content/code") {
/**
* Code
*/
2019-11-27 15:31:49 +07:00
2022-10-23 10:47:50 +07:00
// Reboot based on :
// - normalize.css v8.0.1 | MIT License | github.com/necolas/normalize.css
// - sanitize.css v13.0.0 | CC0 1.0 Universal | github.com/csstools/sanitize.css
//
2019-11-27 15:31:49 +07:00
2022-10-23 10:47:50 +07:00
// 1. Correct the inheritance and scaling of font size in all browsers
// 2. Correct the odd `em` font sizing in all browsers
2023-02-13 17:51:05 +07:00
pre:not(:has(code)),
2022-10-23 10:47:50 +07:00
code,
kbd,
samp {
font-size: 0.875em; // 2
font-family: var(#{$}font-family); // 1
}
2019-11-27 15:31:49 +07:00
2022-10-23 10:47:50 +07:00
// Prevent overflow of the container in all browsers (opinionated)
pre {
-ms-overflow-style: scrollbar;
overflow: auto;
}
2022-10-23 10:47:50 +07:00
// Pico
//
2019-11-27 15:31:49 +07:00
2022-10-23 10:47:50 +07:00
pre,
code,
kbd {
border-radius: var(#{$}border-radius);
background: var(#{$}code-background-color);
color: var(#{$}code-color);
font-weight: var(#{$}font-weight);
line-height: initial;
}
2019-11-27 15:31:49 +07:00
2022-10-23 10:47:50 +07:00
code,
kbd {
display: inline-block;
2023-03-13 22:10:27 +07:00
padding: 0.375rem;
2022-10-23 10:47:50 +07:00
}
2019-11-27 15:31:49 +07:00
2022-10-23 10:47:50 +07:00
pre {
2019-11-27 15:31:49 +07:00
display: block;
2022-10-23 10:47:50 +07:00
margin-bottom: var(#{$}spacing);
overflow-x: auto;
2019-11-27 15:31:49 +07:00
2022-10-23 10:47:50 +07:00
> code {
display: block;
padding: var(#{$}spacing);
background: none;
line-height: var(#{$}line-height);
}
2019-11-27 15:31:49 +07:00
}
2022-10-23 10:47:50 +07:00
// kbd
kbd {
background-color: var(#{$}code-kbd-background-color);
color: var(#{$}code-kbd-color);
vertical-align: baseline;
}
2022-10-15 23:22:12 +07:00
}