em
ch
%
button {
font-size: 1em;
padding: 0.5em 0.75em;
/* Other properties */
}
/* Group common properties together */
.button {
display: inline-block;
padding: 0.5em 0.75em;
font-size: 1em;
}
.button-small {
font-size: 0.8em;
}
.button-large {
font-size: 2em;
}
@mixin button {
display: inline-block;
padding: 0.5em 0.75em;
/* Other common properties */
}
.button-large {
@include button;
font-size: 2em;
}
vw
vh
vmin
vmax
.quarter-screen-rect {
width: 50vw;
height: 50vh;
}
vw
html {
font-size: calc(16px + 0.5vw);
}
h2 {
font-size: 3em;
}
For more, read fluid typography by Mike Riethmuller
px
The quick brown fox jumps over the lazy dog.
.component p:last-child { margin-bottom: 0 }
.module p:last-child,
.module ul:last-child,
.module ol:last-child,
.module dl:last-child {
/* losing battle */
margin-bottom: 0;
}
From this article on CSS-Tricks
h1, h2, h3, h4, h5, h6, ul, ol, li, blockquote {
margin: 0;
padding: 0;
}
* + * {
margin-top: 1em;
}
.component > * + * {
margin-top: 1em;
}
Read lobotomized owl by Heydon Pickering
.button {
margin-top: 1em;
margin-bottom: 1em;
/* Other properties */
}
.button {
font-size: 1em;
margin-top: 1em;
margin-bottom: 1em;
/* Other properties */
}
.button-large {
font-size: 2em;
margin-top: 0.5em;
margin-bottom: 0.5em;
/* Other properties */
}
.button {
font-size: 1em;
margin-top: 1rem;
margin-bottom: 1rem;
/* Other properties */
}
.button-large {
font-size: 2em;
/* Other properties */
}
min-width
queriesmax-width
queriesmin-width
media queries// Note: Always write media queries in `em`.
.component {
@media (min-width: 37.5em) {
font-size: 2em;
}
}
max-width
media queries.component {
font-size: 2em;
@media (max-width: 37.5em) {
font-size: 1em;
}
}
min-width
and max-width
min-width
over max-width
Tomorrow, is the fist blank page of a 365 page book. Write a good one
Brad Paisley
Dec 31 2016
…
…
…
…
.quote {
/* shared styles */
}
.quote--single {
/* single styles */
}
.quote--single .quote__date {
display: none;
}
.quote--grid {
/* grid here */
}
e-
c-
grid-
(.grid-article
)is-
, has-
(.is-active
)js
(.jsModalToggle
)type-
(.type-h1
, .type-h2
)theme-
(.theme-primary
)The specificity graph by Harry Roberts