picocss/scss/content/_typography.scss

216 lines
4.3 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-22 11:44:10 +07:00
2022-10-23 10:47:50 +07:00
@if map.get($modules, "content/typography") {
/**
* Typography
*/
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
// Add the correct font weight in Chrome, Edge, and Safari
b,
strong {
font-weight: bolder;
}
2019-11-27 15:31:49 +07:00
2022-10-23 10:47:50 +07:00
// Prevent `sub` and `sup` elements from affecting the line height in all browsers
sub,
sup {
position: relative;
font-size: 0.75em;
line-height: 0;
vertical-align: baseline;
}
sub {
bottom: -0.25em;
}
sup {
top: -0.5em;
}
2019-11-27 15:31:49 +07:00
2022-10-23 10:47:50 +07:00
// Pico
//
address,
blockquote,
dl,
figure,
form,
ol,
p,
pre,
table,
ul {
margin-top: 0;
margin-bottom: var(#{$}typography-spacing-vertical);
color: var(#{$}color);
font-style: normal;
font-weight: var(#{$}font-weight);
font-size: var(#{$}font-size);
}
2022-10-23 10:47:50 +07:00
// Headings
h1,
h2,
h3,
h4,
h5,
h6 {
margin-top: 0;
margin-bottom: var(#{$}typography-spacing-vertical);
color: var(#{$}color);
font-weight: var(#{$}font-weight);
font-size: var(#{$}font-size);
font-family: var(#{$}font-family);
}
2019-11-27 15:31:49 +07:00
2022-10-23 10:47:50 +07:00
h1 {
#{$✨}color: var(#{$}h1-color);
}
h2 {
#{$✨}color: var(#{$}h2-color);
}
h3 {
#{$✨}color: var(#{$}h3-color);
}
h4 {
#{$✨}color: var(#{$}h4-color);
}
h5 {
#{$✨}color: var(#{$}h5-color);
}
h6 {
#{$✨}color: var(#{$}h6-color);
2019-11-27 15:31:49 +07:00
}
2022-12-29 17:44:09 +07:00
// Margin-top for headings after a block
:where(article, address, blockquote, dl, figure, form, ol, p, pre, table, ul) {
2022-10-23 10:47:50 +07:00
~ :is(h1, h2, h3, h4, h5, h6) {
2022-12-29 17:44:09 +07:00
margin-top: var(#{$}typography-spacing-top);
2022-10-23 10:47:50 +07:00
}
2019-11-27 15:31:49 +07:00
}
2022-10-23 10:47:50 +07:00
// Heading group
@if $enable-classes == false {
hgroup {
margin-bottom: var(#{$}typography-spacing-vertical);
2019-11-27 15:31:49 +07:00
2022-10-23 10:47:50 +07:00
> * {
margin-bottom: 0;
2021-07-02 16:54:41 +07:00
}
2022-10-23 10:47:50 +07:00
> *:last-child {
#{$✨}color: var(#{$}muted-color);
#{$✨}font-weight: unset;
font-size: 1rem;
font-family: unset;
2021-07-02 16:54:41 +07:00
}
2019-11-27 15:31:49 +07:00
}
2022-10-23 10:47:50 +07:00
}
2019-11-27 15:31:49 +07:00
2022-10-23 10:47:50 +07:00
@if $enable-classes {
hgroup,
.headings {
margin-bottom: var(#{$}typography-spacing-vertical);
2022-10-23 10:47:50 +07:00
> * {
margin-bottom: 0;
2021-07-02 16:54:41 +07:00
}
2022-10-23 10:47:50 +07:00
> *:last-child {
#{$✨}color: var(#{$}muted-color);
#{$✨}font-weight: unset;
font-size: 1rem;
font-family: unset;
2021-07-02 16:54:41 +07:00
}
}
}
2022-10-23 10:47:50 +07:00
// Paragraphs
p {
margin-bottom: var(#{$}typography-spacing-vertical);
}
2019-11-27 15:31:49 +07:00
2022-10-23 10:47:50 +07:00
// Small
small {
font-size: var(#{$}font-size);
2020-09-12 10:38:23 +07:00
}
2019-11-27 15:31:49 +07:00
2022-10-23 10:47:50 +07:00
// Lists
:where(dl, ol, ul) {
padding-right: 0;
padding-left: var(#{$}spacing);
padding-inline-start: var(#{$}spacing);
padding-inline-end: 0;
2022-10-23 10:47:50 +07:00
li {
margin-bottom: calc(var(#{$}typography-spacing-vertical) * 0.25);
2021-12-31 11:42:44 +07:00
}
2022-10-23 10:47:50 +07:00
}
2022-10-23 10:47:50 +07:00
// Margin-top for nested lists
// 1. Remove the margin on nested lists in Chrome, Edge, IE, and Safari
:where(dl, ol, ul) {
:is(dl, ol, ul) {
margin: 0; // 1
margin-top: calc(var(#{$}typography-spacing-vertical) * 0.25);
2021-12-31 11:42:44 +07:00
}
}
2022-10-23 10:47:50 +07:00
ul li {
list-style: square;
}
2022-10-23 10:47:50 +07:00
// Highlighted text
mark {
padding: 0.125rem 0.25rem;
background-color: var(#{$}mark-background-color);
color: var(#{$}mark-color);
vertical-align: baseline;
}
2022-10-23 10:47:50 +07:00
// Blockquote
blockquote {
display: block;
margin: var(#{$}typography-spacing-vertical) 0;
padding: var(#{$}spacing);
border-right: none;
border-left: 0.25rem solid var(#{$}blockquote-border-color);
border-inline-start: 0.25rem solid var(#{$}blockquote-border-color);
border-inline-end: none;
footer {
margin-top: calc(var(#{$}typography-spacing-vertical) * 0.5);
color: var(#{$}blockquote-footer-color);
}
}
2019-11-27 15:31:49 +07:00
2022-10-23 10:47:50 +07:00
// Abbreviations
// 1. Remove underline decoration in Chrome, Edge, IE, Opera, and Safari
abbr[title] {
border-bottom: 1px dotted;
text-decoration: none; // 1
cursor: help;
2022-03-06 12:11:41 +07:00
}
2022-10-23 10:47:50 +07:00
// Ins
ins {
color: var(#{$}ins-color);
text-decoration: none;
2019-11-27 15:31:49 +07:00
}
2022-10-23 10:47:50 +07:00
// del
del {
color: var(#{$}del-color);
2019-11-27 15:31:49 +07:00
}
2022-10-23 10:47:50 +07:00
// selection
::selection {
2023-01-28 12:22:55 +07:00
background-color: var(#{$}text-selection-color);
2022-10-23 10:47:50 +07:00
}
2022-10-15 23:22:12 +07:00
}