Browser default initial CSS styles with integrated custom properties.
- Despite the advancements in modern browsers, it is still good to have a basic corrections for the default CSS styles of the browser - the so-called
user agent stylesheet. - Our goal was to provide a basic styles that can easily integrate with
CSS custom properties, simplify theCSS cascade, allow for easy implementation oflight and dark themes, integratemore than six different heading stylesand more. As we were unable to find any comparable open-source solutions, we decided to create our own and open it to the community.
- Simple and small. Only modern Browsers are supported (>1% usage).
- Simplified CSS cascade. One way to simplify CSS cascade is by utilizing the
:where()pseudo-class with zero specificity. This makes it effortless to modify styles in any location at a later time. - Ten heading styles. We've added four new heading styles to the existing six, providing more visual design options while maintaining accessibility and correct heading semantics.
- Easy implementation of light and dark themes.
- Flexible integration. You can use
initial.cssas a base for your own project or integrate part of initial.css - for example, only the root stylessrc/root.cssor only the heading stylessrc/heading.css. Check thesrc/initialfolder for more details. - Integrated CSS custom properties. You won't have to create new styles on top of existing ones and then modify them later. CSS custom properties are already included in
initial.css, so you can simply adjust them to suit your requirements.
instead of this three steps:
- add
normalize.css
body {
background-color: var(--bg-color);
}:root {
--bg-color: red;
}you can simply do this:
:root {
--bg-color: red;
}- Manually add
initial.cssorinitial.min.cssas a base to your project fromdistfolder of the repository.
- Install
initial.cssnpm package
npm install @resultify/initial.css
- Import
initial.cssto your project for example withpostcss-import
@import '@resultify/initial.css';
- Add your own light/dark theme styles. Examples you can find in
src/themefolder. - Add your own design variations. Examples you can find in
src/design-variationsfolder. - You can also find some useful CSS utilities in
src/utilsfolder which you can directly import to your project or paste only parts of code to your own CSS files. - There are also accessibility helpers in
src/accessibilityfolder which can be useful for your project. - Add print styles to your project. Example you can find in
src/print.css.
- Clone/fork the repository and run
npm installto install dependencies. - Run
npm startto start the development server with watcher. - Add your changes to
src/*files and test the result in browser onhttp://localhost:8083 - Run
npm testto run tests. - Commit your changes and create a pull request.