picocss/scss/content/_typography.scss

327 lines
5.4 KiB
SCSS
Raw Normal View History

2019-11-27 15:31:49 +07:00
/**
* Typography
*/
// 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
//
// Add the correct font weight in Chrome, Edge, and Safari
2019-11-27 15:31:49 +07:00
b,
strong {
2019-11-28 21:51:58 +07:00
font-weight: bolder;
2019-11-27 15:31:49 +07:00
}
// Prevent `sub` and `sup` elements from affecting the line height in all browsers
2019-11-27 15:31:49 +07:00
sub,
sup {
position: relative;
font-size: .75rem;
line-height: 0;
vertical-align: baseline;
}
sub {
bottom: -0.25rem;
}
sup {
top: -0.5rem;
}
// Remove the margin on nested lists in Chrome, Edge, IE, and Safari
dl dl,
dl ol,
dl ul,
ol dl,
ul dl {
margin: 0;
2019-11-27 15:31:49 +07:00
}
// Remove the margin on nested lists in Edge 18- and IE
ol ol,
ol ul,
ul ol,
ul ul {
margin: 0;
2019-11-27 15:31:49 +07:00
}
// Pico
//
address,
blockquote,
dl,
figure,
form,
ol,
p,
pre,
table,
ul {
margin-top: 0;
2020-09-29 08:38:35 +07:00
margin-bottom: var(--spacing-typography);
2019-11-27 15:31:49 +07:00
color: var(--text);
font-size: 1rem;
font-style: normal;
}
// Links
// 1. Remove the gray background on active links in IE 10
2019-11-27 15:31:49 +07:00
a {
background-color: transparent; // 1
color: var(--primary);
text-decoration: none;
@if $enable-transitions {
transition:
2020-09-29 08:38:35 +07:00
background-color var(--transition),
color var(--transition),
text-decoration var(--transition),
box-shadow var(--transition);
}
2019-11-27 15:31:49 +07:00
&:hover,
&:active,
&:focus {
color: var(--primary-hover);
text-decoration: underline;
}
&:focus {
outline: none;
background-color: var(--primary-focus);
}
}
// Link .secondary
@if $enable-classes {
a.secondary {
color: var(--secondary);
2020-09-29 08:38:35 +07:00
text-decoration: underline;
2019-11-27 15:31:49 +07:00
&:hover,
&:active,
&:focus {
color: var(--secondary-hover);
}
&:focus {
background-color: var(--secondary-focus);
}
}
}
// Link .contrast
@if $enable-classes {
2020-09-29 08:38:35 +07:00
a.contrast {
color: var(--contrast);
2020-09-29 08:38:35 +07:00
text-decoration: underline;
&:hover,
&:active,
&:focus {
color: var(--contrast-hover);
}
&:focus {
background-color: var(--contrast-focus);
}
}
}
2019-11-27 15:31:49 +07:00
// Headings
// Because vertical margins can collapse, we avoid `margin-top`
h1,
h2,
h3,
h4,
h5,
h6 {
margin-top: 0;
2020-09-29 08:38:35 +07:00
margin-bottom: var(--spacing-typography);
font-family: var(--titles-font);
2020-09-29 08:38:35 +07:00
font-weight: var(--titles-weight);
2019-11-27 15:31:49 +07:00
}
h1 {
2020-09-29 08:38:35 +07:00
margin-bottom: calc(var(--spacing-typography) * 2);
2019-11-27 15:31:49 +07:00
color: var(--h1);
2020-09-29 08:38:35 +07:00
font-size: var(--h1-size);
2019-11-27 15:31:49 +07:00
}
h2 {
2020-09-29 08:38:35 +07:00
margin-bottom: calc(var(--spacing-typography) * 1.75);
2019-11-27 15:31:49 +07:00
color: var(--h2);
2020-09-29 08:38:35 +07:00
font-size: var(--h2-size);
2019-11-27 15:31:49 +07:00
}
h3 {
2020-09-29 08:38:35 +07:00
margin-bottom: calc(var(--spacing-typography) * 1.5);
2019-11-27 15:31:49 +07:00
color: var(--h3);
2020-09-29 08:38:35 +07:00
font-size: var(--h3-size);
2019-11-27 15:31:49 +07:00
}
h4 {
2020-09-29 08:38:35 +07:00
margin-bottom: calc(var(--spacing-typography) * 1.25);
2019-11-27 15:31:49 +07:00
color: var(--h4);
2020-09-29 08:38:35 +07:00
font-size: var(--h4-size);
2019-11-27 15:31:49 +07:00
}
h5 {
2020-09-29 08:38:35 +07:00
margin-bottom: calc(var(--spacing-typography) * 1.125);
2019-11-27 15:31:49 +07:00
color: var(--h5);
2020-09-29 08:38:35 +07:00
font-size: var(--h5-size);
2019-11-27 15:31:49 +07:00
}
h6 {
color: var(--h6);
2020-09-29 08:38:35 +07:00
font-size: var(--h6-size);
2019-11-27 15:31:49 +07:00
}
// Margin-top for headings after a typography block
address,
blockquote,
dl,
figure,
form,
ol,
p,
pre,
table,
ul {
2020-09-12 10:38:23 +07:00
& ~ h1 {
2020-09-29 08:38:35 +07:00
margin-top: calc(var(--spacing-typography) * 2);
2020-09-12 10:38:23 +07:00
}
& ~ h2 {
2020-09-29 08:38:35 +07:00
margin-top: calc(var(--spacing-typography) * 1.75);
2020-09-12 10:38:23 +07:00
}
& ~ h3 {
2020-09-29 08:38:35 +07:00
margin-top: calc(var(--spacing-typography) * 1.5);
2020-09-12 10:38:23 +07:00
}
& ~ h4 {
2020-09-29 08:38:35 +07:00
margin-top: calc(var(--spacing-typography) * 1.25);
2020-09-12 10:38:23 +07:00
}
& ~ h5 {
2020-09-29 08:38:35 +07:00
margin-top: calc(var(--spacing-typography) * 1.125);
2020-09-12 10:38:23 +07:00
}
& ~ h6 {
2020-09-29 08:38:35 +07:00
margin-top: calc(var(--spacing-typography));
2020-09-12 10:38:23 +07:00
}
2019-11-27 15:31:49 +07:00
}
// Multi-level heading
hgroup {
2020-09-29 08:38:35 +07:00
margin-bottom: var(--spacing-typography);
*{
margin-bottom: 0;
}
> *:last-child {
color: var(--muted-text);
font-family: unset;
font-size: 1.125rem;
2020-09-29 08:38:35 +07:00
font-weight: unset;
}
}
// Paragraphs
p {
2020-09-29 08:38:35 +07:00
margin-bottom: var(--spacing-typography);
}
2019-11-27 15:31:49 +07:00
// Small
small {
font-size: 85%;
@if map-get($breakpoints, "sm") and $enable-responsive-typography {
@media (min-width: map-get($breakpoints, "sm")) {
font-size: 83%;
}
}
@if map-get($breakpoints, "md") and $enable-responsive-typography {
@media (min-width: map-get($breakpoints, "md")) {
font-size: 81%;
}
}
@if map-get($breakpoints, "lg") and $enable-responsive-typography {
@media (min-width: map-get($breakpoints, "lg")) {
font-size: 79%;
}
}
@if map-get($breakpoints, "lg") and $enable-responsive-typography {
@media (min-width: map-get($breakpoints, "xl")) {
font-size: 77%;
}
}
}
// Lists
ul,
ol {
2020-09-29 08:38:35 +07:00
padding-left: var(--spacing-typography);
2019-11-27 15:31:49 +07:00
li {
2020-09-29 08:38:35 +07:00
margin-bottom: calc(var(--spacing-typography) / 4);
2019-11-27 15:31:49 +07:00
}
}
2019-11-27 15:31:49 +07:00
ul li {
list-style: square;
}
// Marked text
mark {
padding: .125rem .25rem;
background: var(--mark);
color: var(--mark-text);
2019-11-27 15:31:49 +07:00
vertical-align: middle;
}
// Blockquote
blockquote {
display: block;
2020-09-29 08:38:35 +07:00
margin: var(--spacing-typography) 0;
padding: var(--spacing-gutter);
2019-11-27 15:31:49 +07:00
border-left: .25rem solid var(--muted-border);
footer {
2020-09-29 08:38:35 +07:00
margin-top: calc(var(--spacing-typography) / 2);
2019-11-27 15:31:49 +07:00
color: var(--muted-text);
}
}
// Abbreviations
// 1. Remove underline decoration in Chrome, Edge, IE, Opera, and Safari
2019-11-27 15:31:49 +07:00
abbr[title] {
border-bottom: 1px dotted;
text-decoration: none; // 1
cursor: help;
}
// Ins
ins {
color: var(--valid);
text-decoration: none;
}
2019-11-27 15:31:49 +07:00
// del
del {
color: var(--invalid);
}
// selection
::selection {
background-color: var(--primary-focus);
}