<main>
<div class="any-selector">
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Sed dictum laoreet neque, a vulputate velit placerat in.
Nulla et arcu ut ex elementum posuere sed ac ex. Suspendisse potenti.
</div>
</main>
/* Define variables with the syntax --var-name: value. Commonly done on :root (= <html>), but possible on any element */
:root {
/* Creating a variable */
--theme-color: hsl(180, 100%, 10%);
/* Variables can have any value allowed in CSS */
--border: .1rem silver solid;
/* Variable nesting is possible */
--family: Arial, Helvetica, sans-serif;
--variant: small-caps;
--size: 1.5rem;
--font: var(--variant) var(--size)/1.5 var(--family);
}
/* Using a variable */
.any-selector {
background: var(--theme-color);
border: var(--border);
/* further nesting possible */
font: italic var(--font);
}
/* the not so relevant part */
div {
width: 70%;
padding: 2rem
}
/* basic styling */
body {
background: #1d1e22;
color: white;
font: 16px sans-serif
}
// Basic set-up for article
// Themes with CSS variables and hsl()
main {
min-height: 100vh;
display: flex;
align-items: center;
justify-content: center;
}
table {
border: none;
border-collapse: collapse;
}
td[class^="bg-"] {
font: 1.2rem var(--monospace-font);
text-align: center;
vertical-align: middle;
min-width: 11rem;
height: 6rem;
}
caption {
text-align: left;
padding: 1rem;
}
@import url("https://fonts.googleapis.com/css?family=Roboto|Roboto+Mono&display=swap");
:root {
--background-color: hsl(228, 8%, 12%);
--text-color: hsl(0, 0%, 85%);
--border-color: hsl(228, 8%, 20%);
--transparency-bg: url(data:image/gif;base64,R0lGODlhDAAMAHAAACH/C05FVFNDQVBFMi4wAwEAAAAh+QQICgAAACwAAAAADAAMAIDX19f///8CFoQfqYeabNyDMkBQb81Uat85nxguUAEAOw==);
--border-radius: .3rem;
--regular-font: Roboto, sans-serif;
--monospace-font: 'Roboto Mono', monospace;
--form-field-bg: hsl(0, 0%, 95%);
--form-field-color: hsl(228, 8%, 12%);
--link-color: hsl(206, 89%, 45%);
}
html {
font-size: 62.5%;
box-sizing: border-box;
}
a {
color: var(--link-color);
}
*,
*:before,
*:after {
box-sizing: inherit;
}
body {
font: 1.4rem/1.5 var(--regular-font);
background: var(--background-color);
color: var(--text-color);
margin: 0;
}
h1 {
font-size: 2.4rem;
}
input, textarea, pre, select, [data-preview] {
background: var(--form-field-bg);
color: var(--form-field-color);
}
code, input, textarea, pre, select, [data-preview] {
font-family: var(--monospace-font);
}
input, textarea, pre, select, fieldset, [data-preview] {
border: .1rem var(--border-color) solid;
}
pre {
color: hsl(0, 0%, 15%);
background: hsl(0, 0%, 85%);
padding: 1rem;
max-height: calc(100vh - 40px);
overflow: auto;
}
View Compiled
This Pen doesn't use any external CSS resources.
This Pen doesn't use any external JavaScript resources.