makeup-style
So you want to makeup style? These minimal CSS files corrects and improves default browser CSS; for styling in general and typographic style.
npm install makeup-style
Also consider using a library like postcss-preset-env for auto prefixing and fixing of newer rules for older browsers.
Import examples
The files are exported from “package.json” as ESM. The actual files are located in the “src” folder if you need the real path.
import "makeup-style/default.css";
import "makeup-style/develop.css";
Alternative files that use :where()
for less specificity:
import "makeup-style/where-default.css";
import "makeup-style/where-develop.css";
CSS import (via postcss-import or Lightning CSS):
@import "makeup-style/default.css";
@import "makeup-style/develop.css";
/* Alt. files */
@import "makeup-style/where-default.css";
@import "makeup-style/where-develop.css";
Default CSS
Import default.css, or the alternate where-default.css that uses :where()
for less specificity.
Their rules corrects and improves the minimal necessary default CSS, ready for other layers of style on top:
- Up to date minimal browser normalizing.
- Responsive rules for small screen-sizes including universal
border-box
to prevent overflow and make styling intuitive, and otherwise prevent overflowing content withhyphens
,overflow-wrap
and improving some element to be responsive. - Fix elements that disrupts typographic rhythm.
- Intuitive
cursor
values for usability.
All rules are included with the mindset of this generally fixing and improving default CSS in a minimal way. It does not style headings, or what would otherwise belong in your actual theme. For form elements, some input related elements get a max-width: 100%
and button elements gets cursor: pointer
—nothing more as they work cross browsers and restyling is a matter of opinion. But resetting their style is now quite easy using all
and apperance
.
This file is an alternative to normalize.css, modern-normalize, CSS Remedy, sanitize.css and similar—updated for all major browsers and with the latest CSS properties. The actual few, up-to-date, low-level CSS rules you want below your styling.
Notes & Tips
Cloudflare’s auto minify of CSS may remove space before CSS attribute selector ignore case flag.
Margin for
<body>
is not removed. So you usually also want to stylebody { margin: 0; }
.To allow browsers to auto hyphenate words when text wraps,
hyphens: auto
is applied. It is not accompanied by rules to control auto-hyphens.hyphens: manual
may be set (for some elements) on wider viewports and/or for advanced content creators who knows theshy
HTML entity.code, kbd, samp, sub, sup
are styled to not affect line-heights. If they are used as block-level elements though, they will be short in height since theirline-height
is adjusted. E.g., if their direct parent usesgrid
orflex
. The solution is to redo your HTML structure (perhaps it can be more semantic?), or restyleline-height
for these elements in this context.If
font-size
forcode, kbd, samp, pre
is defined, but notfont-family
, and no parent is styled withfont-size
, then browsers will not compute thefont-size
for these elements intuitively (e.g., with default browser settings,1em
would be computed to13px
instead of16px
).Fix by defining before mentioned, or by
code, kbd, samp, pre { font-family: monospace, monospace; }
(this is not defined by default because of it’s sideeffect of initially increasing their font-sizes).<hr>
‘border’ usesheight
andbackground
for a nicer border. This makes it easy to adjust and extend:hr { /* Gradient border */ background-image: linear-gradient(90deg, red, blue); /* Change size */ background-size: 5em 2px; /* Change position */ background-position: left center; /* Change spacing */ height: 2em; }
Check browser support for properties
hyphens
andall
, and consider automating fallbacks and polyfill with postcss-preset-env or similar.
Develop CSS—A Default CSS Expansion
Import develop.css, or the alternate where-develop.css that uses :where()
for less specificity.
For developer convenience, it includes some simple rules for more intuitive coding, and reduce-motion rules for animations and transitions so accessibility is easier preserved.