@ztimson/css-utils
CSS Utils is a css library based on bootstrap. At 1/3 the size, its all the utilities without the bloat.
Some additional utilities have been added & a few have been renamed to conform to convention or remove redundancy.
Setup
Install
NPM
// Install
npm install @ztimson/css-utils
// Import one of: (CSS/minified/SCSS)
@import url("@ztimson/css-utils/dist/css-utils.css");
@import url("@ztimson/css-utils/dist/css-utils.min.css");
@import url("@ztimson/css-utils/src/main.scss");
Script Tags
<!-- Include one of -->
<link rel="stylesheet" href="https://css.zakscode.com/dist/css-utils.css" ></link>
<link rel="stylesheet" href="https://css.zakscode.com/dist/css-utils.min.css" ></link>
<link rel="stylesheet" href="https://css.zakscode.com/src/main.scss" ></link>
Theming
Theming is minimal since its so opinionated. Its all done through CSS variables allowing runtime manipulation without having to recompile.
// Theme colors -- what ever you like
--theme-backdrop: #dddddd; // Background color of body, not to be confused with `--theme-clear`
--theme-primary: #ff0000;
--theme-accent: #0000ff;
--theme-info: #6157cc;
--theme-success: #65c147;
--theme-warn: #d88750;
--theme-danger: #bf4f4f;
--theme-black: black;
--theme-white: white;
// Misc
--theme-animation: 0.2s linear; // Animation style
--theme-content-width: 1100px; // Max width of `.clamped` content
--theme-font: Arial, sans-serif; // Forces font globally
// Light theme
.theme-light {
--theme-clear: #ffffff; // Content background (Usually white or off-black which contrasts --theme-text)
--theme-text: #000000; // Text color (Should contrast --theme-clear)
--theme-muted: #6c757d; // Muted text color (Should have less than contrast than --theme-text)
}
// Dark theme
.theme-dark {
--theme-clear: #2e2e2e; // Content background (Usually white or off-black which contrasts --theme-text)
--theme-text: #ffffff; // Text color (Should contrast --theme-clear)
--theme-muted: #cccccc; // Muted text color (Should have less than contrast than --theme-text)
}
// Multiple themes can be toggled via CSS classes
.theme-custom {
...
}
The generated breakpoints & margin/padding sizes can also be adjusted through SCSS.
$breakpoints: (xs: 0, sm: 576px, md: 768px, lg: 992px, xl: 1200px); // Device size
$sizes: ('auto': auto, 0: 0, 1: 0.25rem, 2: 0.5rem, 3: 1rem, 4: 1.5rem, 5: 2.5rem); // Padding/Margin, etc...
Utilities
Alignment
.align-[x|y]-[xs|sm|md|lg|xl]-[start|end]
text-align & vertical-align are used with align-x & align-y respectively.
.align-y-end
|
.align-y
|
.align-y-start
|
Animations
.animate-[color|none|opacity|pos|trans]
Style changes will be animated using the --theme-animation variable
Borders
Color
.b-[accent|black|danger|info|muted|primary|success|text|warn|white]
.b-accent
.b-black
.b-danger
.b-info
.b-muted
.b-primary
.b-success
.b-text
.b-warn
.b-white
Radius
.br-[0-5]
.br-0
.br-1
.br-2
.br-3
.br-4
.br-5
.br-pill
.br-circle
Style
.b-[xs|sm|md|lg|xl]-[dash|dot|double|none|solid]
.b-dash
.b-dot
.b-double
.b-none
.b-solid
Width
.b[b|e|s|t]-[xs|sm|md|lg|xl]-[0-5]
.b-0
.b-1
.b-2
.b-3
.b-4
.b-5
Colors
Background
.bg-[accent|backdrop|black|clear|danger|info|muted|primary|success|transparent|text|warn|white]
.bg-accent
.bg-backdrop
.bg-black
.bg-clear
.bg-danger
.bg-info
.bg-muted
.bg-primary
.bg-success
.bg-transparent
.bg-text
.bg-warn
.bg-white
Borders
.b-[accent|black|clear|danger|info|muted|primary|success|text|warn|white]
.b-accent
.b-black
.b-danger
.b-info
.b-muted
.b-primary
.b-success
.b-text
.b-warn
.b-white
Foreground
.fg-[accent|black|danger|info|muted|primary|success|text|warn|white]
.fg-accent
.fg-black
.fg-clear
.fg-danger
.fg-info
.fg-muted
.fg-primary
.fg-success
.fg-text
.fg-warn
.fg-white
Cursors
.curs-[alias|auto|cell|col-resize|copy|crosshair|default|grab|grabbing|help|hover|move|not-allowed|pointer|progress|row-resize|text|none|wait|vertical-text|zoom-in|zoom-out]
.curs-alias
.curs-auto
.curs-cell
.curs-col-resize
.curs-copy
.curs-crosshair
.curs-default
.curs-grab
.curs-grabbing
.curs-help
.curs-hover
.curs-move
.curs-not-allowed
.curs-pointer
.curs-progress
.curs-row-resize
.curs-text
.curs-none
.curs-wait
.curs-vertical-text
.curs-zoom-in
.curs-zoom-out
Display
.d-[xs|sm|md|lg|xl]-[block|flex|grid|inline|inline-block|inline-flex|inline-grid|none|table|table-cell|table-row]
Flex
Direction
.flex-[xs|sm|md|lg|xl]-[c|r|rc|rr]
Justify / Align
.justify-[xs|sm|md|lg|xl]-[around|between|center|end|evenly|start]
.align-[xs|sm|md|lg|xl]-[content|items|self]-[baseline|center|end|start|stretch]
.align-self-baseline
.align-self-center
.align-self-end
.align-self-start
.align-self-stretch
Order
.order-[xs|sm|md|lg|xl]-[0-5]
.order-5
.order-4
.order-3
.order-2
.order-1
.order-0
Size
.flex-[xs|sm|md|lg|xl]-[grow|shrink]-[0-3]
.flex-grow-1
.flex-shrink-1
.flex-grow-1
.flex-grow-2
.flex-fill-[even]
.flex-fill (Matches content ratio)
.flex-fill
.flex-fill
.flex-fill-even (Doesn't match content ratio)
.flex-fill-even
.flex-fill-even
Wrap
.flex-[xs|sm|md|lg|xl]-[nowrap|wrap]
Float
.float-[xs|sm|md|lg|xl]-[end|none|start]
.float-none
.float-end
.float-start
Font Style
Decoration
.fs-[italic|line-through|none|underline]
.fs-italic
.fs-line-through
.fs-none
.fs-underline
Size
.fs-[1-7]
.fs-1
.fs-2
.fs-3
.fs-4
.fs-5
.fs-6
.fs-7
Weight
.fs-[bold|bolder|lighter|normal]
.fs-bold
.fs-bolder
.fs-lighter
.fs-normal
Wrapping
.fs-[break|nowrap|truncate|wrap]
.fs-break |
Lorem ipsum dolor sit amet elitr sit. Consetetur dolore in ipsum consetetur in voluptua ut accusam consetetur commodo voluptua amet dolore ipsum. Sit amet sit
|
.fs-nowrap |
Lorem ipsum dolor sit amet elitr sit. Consetetur dolore in ipsum consetetur in voluptua ut accusam consetetur commodo voluptua amet dolore ipsum. Sit amet sit
|
.fs-truncate |
Lorem ipsum dolor sit amet elitr sit. Consetetur dolore in ipsum consetetur in voluptua ut accusam consetetur commodo voluptua amet dolore ipsum. Sit amet sit
|
.fs-wrap |
Lorem ipsum dolor sit amet elitr sit. Consetetur dolore in ipsum consetetur in voluptua ut accusam consetetur commodo voluptua amet dolore ipsum. Sit amet sit
|
Overflow
.overflow-[x|y]-[auto|hidden|scroll|visible]
Opacity
.opacity-[0|10|20|25|30|33|34|40|50|60|66|70|75|80|90|100]
.o-0
.o-10
.o-20
.o-30
.o-40
.o-50
.o-60
.o-70
.o-80
.o-90
.o-100
Position
.pos-[abs|rel|static|stick]
Anchor
.anchor-[c|e|s]
.anchor-s
.anchor-c
.anchor-e
Position
.[bottom|end|start|top]-[0|10|20|25|30|33|34|40|50|60|66|70|75|80|90|100]
.top-0 .start-0
.top-0 .end-0
.top-50 .start-50
.bottom-50 .end-50
.bottom-0 .start-0
.bottom-0 .end-0
.center
Shadows
.shadow-[drop|none|white]
.shadow
.shadow-drop
.shadow-white
.shadow-none
Size
Height
.h-[0|10|20|25|30|33|34|40|50|60|66|70|75|80|90|100]
Width
.w-[0|10|20|25|30|33|34|40|50|60|66|70|75|80|90|100]
Spacing
Margin: .m[b|e|s|t|x|y]-[xs|sm|md|lg|xl]-[0-5|auto]
Padding: .p[b|e|s|t|x|y]-[xs|sm|md|lg|xl]-[0-5]
User Select
.select-[all|auto|none|text]
.select-all
.select-auto
.select-none
.select-text
Visibility
.[hidden|visible]-[xs|sm|md|lg|xl]