Skip to content
This repository was archived by the owner on Dec 6, 2022. It is now read-only.

Latest commit

History

93 Commits

Folders and files

NameName
Last commit message
Last commit date

Repository files navigation

Next.css Core Module

Core Module is part of Next.css framework. This module contains original Material Color Palette CSS styles for your Next.css project. You can use in all modern websites with module bundlers, like webpack, rollup, parcel.

Next.css on GitHub

How to Install

You can install with npm or yarn package managers.

npm i @nextcss/core @nextcss/reset @nextcss/material-colors
yarn add @nextcss/core @nextcss/reset @nextcss/material-colors

Simple import to your project, and add class rules to you HTML tags. Check available selector rules below.

import'@nextcss/reset';import'@nextcss/core';import'@nextcss/material-colors';

How to use

Example feature list block. Watch the resolution here Learn more about available CSS selectors below.

<sectionclass="fs-16 lh-1.6 bg-grey-50 fg-grey-700 py-50"><!-- Container --><divclass="container-lg"><!-- Intro --><divclass="container-md text-center mb-20"><h1class="fs-24 md:fs-30 fw-500 fg-grey-900 mb-10">Why Next.css</h1><p>The world’s developers thinking in pixels, we also thinking in pixels.</p></div><!-- Feature list --><divclass="flex flex-wrap"><!-- Feature box --><ahref="#" class="md:w-12/6 lg:w-12/4 p-15"><divclass="bg-white p-25 radius-3 shadow-1"><h2class="fs-20 fw-500 fg-grey-900 mb-8">Shooting Stars</h2><pclass="leading-relaxed text-base mb-4">
Fingerstache flexitarian street art 8-bit waistcoat. ..
</p><spanclass="fg-pink-500 inline-flex align-center">Learn More →</span></div></a><!-- Repeated block here -->
..
</div></div></section>

Selectors

Responsive prefixes

Most classes you will encounter can be used with responsive prefixes. This gives you the option to use classes according to the screen size.

Example

<pclass="fs-12 sm:fs-13 md:fs-14 lg:fs-16 xl:fs-18">
Lorem ipsum dolor sit amet, consectetur adipisicing elit.
</p>

References

PrefixScreen sizeBreakpoint
Defaultnone
sm:Small390px
md:Medium768px
lg:Large1024px
xl:Extra large1400px

Containers

Containers are used to limit the width of content, preventing content from overflowing beyond the specified size.

Example

<divclass="container-xl">content</div>

References

ClassnameMax. widthClassnameMax. width
container-xs480pxcontainer-xs/2240px
container-sm640pxcontainer-sm/2320px
container-md768pxcontainer-md/2384px
container-lg1024pxcontainer-lg/2512px
container-xl1280pxcontainer-xl/2640px

Padding and Margins

Padding is used to create space around an element's content, inside of any defined borders.

Example

<divclass="px-5 py-10 mx-5 my-10">content</div>

References

These classes can be combined with Responsive prefixes.

ClassnameClassnameSideValues (1px step)Values (5px step)
p-{value}m-{value}around[0..10][15..500]
px-{value}mx-{value}horizontal[0..10][15..500]
py-{value}my-{value}vertical[0..10][15..500]
pt-{value}mt-{value}top[0..10][15..500]
pb-{value}mb-{value}bottom[0..10][15..500]
pl-{value}ml-{value}left[0..10][15..500]
pr-{value}ml-{value}right[0..10][15..500]

Borders

Borders allow you to specify the style, width, and color of an element's border.

Example

<divclass="b-2 b-dashed radius-5">content</div>

Border with

ClassnameSideValues (1px step)Values (5px step)
b-{value}around[0..10][15..100]
bx-{value}horizontal[0..10][15..100]
by-{value}vertical[0..10][15..100]
bt-{value}top[0..10][15..100]
bb-{value}bottom[0..10][15..100]
bl-{value}left[0..10][15..100]
br-{value}right[0..10][15..100]

Border style

ClassnameUsageStyles
b-{style}common[none|solid|dashed|dotted|double|groove|inset|outset|ridge]
b-{style}tables[collapse|separate]

Border radius

These classes can be combined with Responsive prefixes.

ClassnameValues (1px step)Values (5px step)Specific values
r-{value}[0..10][15..100][1000|10000]

Font size

Example

<pclass="fs-12 sm:fs-13 md:fs-14 lg:fs-15 xl:fs-16">
Lorem ipsum dolor sit amet, consectetur adipisicing elit.
</p>

References

These classes can be combined with Responsive prefixes.

ClassnameValues (1px step)Values (2px step)Values (5px step)
fs-{value}[10..20][22..40][45..150]

Font weight

Example

<pclass="fw-900 sm:fw-800 md:fw-700 lg:fw-600 xl:fw-500">
Lorem ipsum dolor sit amet, consectetur adipisicing elit.
</p>

References

These classes can be combined with Responsive prefixes.

ClassnameValues (100px step)
fw-{value}[100..900]

Line height

Example

<pclass="lh-1.6">Lorem ipsum dolor sit amet, consectetur adipisicing elit.</p>

References

ClassnameValues (0.1 step)
lh-{value}[0..6]

Text manipulation

Example

<pclass="uppercase underline text-center">
Lorem ipsum dolor sit amet, consectetur adipisicing elit.
</p>

References

ClassnameRelsult
uppercaretext-transform: uppercase
lowercasetext-transform: lowercase
capitalizetext-transform: capitalize
underlinetext-decoration: underline
line-throughtext-decoration: line-through
no-transformtext-transform: none
no-decorationtext-decoration: none

These classes can be combined with Responsive prefixes.

ClassnameRelsult
text-lefttext-align: left
text-centertext-align: center
text-righttext-align: right
text-justifytext-align: justify
text-trimtext-overflow: ellipsis

Display

Example

<divclass="block md:flex">content</div>

References

These classes can be combined with Responsive prefixes.

ClassnameResult
inlinedisplay: inline
blockdisplay: block
inline-blockdisplay: inline-block
flexdisplay: flex
inline-flexdisplay: inline-flex

Order

Example

<ulclass="flex"><liclass="order-2">Item 2</li><liclass="order-1">Item 1</li></ul>

References

These classes can be combined with Responsive prefixes.

ClassnameValues (1 step)Specific values
order-{value}[0...12][first|last]

Overflow

Example

<divclass="md:h-300 md:overflow-y-overlay"><divclass="flex overflow-hidden">content</div></div>

References

These classes can be combined with Responsive prefixes.

ClassnameDirectionSpecific values
of-{value}Both[auto|hidden|visible|scroll|overlay]
of-x-{value}Horizontal[auto|hidden|visible|scroll|overlay]
of-y-{value}Vertical[auto|hidden|visible|scroll|overlay]

Overscroll

Example

<divclass="h-300 overscroll-contain">content</div>

References

These classes can be combined with Responsive prefixes.

ClassnameDirectionSpecific values
os-{value}Both[auto|contain|none]
os-x-{value}Horizontal[auto|contain|none]
os-y-{value}Vertical[auto|contain|none]

Object fit and position

Example

<divclass="w-200 h-200"><imgsrc="" alt="" class="fit-cover" /></div>

References

These classes can be combined with Responsive prefixes.

ClassnameSpecific values
fit-{value}[contain|cover|fill]
object-{value}[center|top|right|bottom|left]

Floating and Box sizing

Example

<divclass="float-none md:float-left">content</div><divclass="clear-both">content</div><divclass="box-content">content</div>

References

These classes can be combined with Responsive prefixes.

ClassnameSpecific values
float-{value}[left|right|none]
clear-{value}[left|right|both|none]
box-{value}[border|content]

Production build

We strongly recommend to use postcss with autoprefixer and postcss-purgecss. This stack will extend the CSS rules with browser specific prefixes, like -webkit and will remove unused styles in production build.

npm i -D postcss autoprefixer @fullhuman/postcss-purgecss

Our postcss.config.js config. You need to configure the content parameter for your project.

module.exports={plugins:
process.env.NODE_ENV==='production'
? ['autoprefixer',['@fullhuman/postcss-purgecss',{content: ['./{pages,components}/**/*.{js,jsx}'],safelist: ['html','body'],defaultExtractor: (content)=>content.match(/[\w-/:]+(?<!:)/g)||[],},],]
: ['autoprefixer'],};

License

MIT License. Copyright (c) 2021 Zsolt Tovis

Sponsor this project

Used by

Contributors

Languages