A minimal css framework.
# Getting started
To add vdlcss to your site, download it and include it in your <head>
.
Don't forget to add the meta tag to allow responsive styling.
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link rel="stylesheet" type="text/css" href="vdlcss-min.css">
Download
# Features
# List of features
# Viewports
As part of the vision to keep this framework as minimal as possible, we decided to use only the following viewports:
Breakpoint | Class prefix | min-width |
---|---|---|
Small | default | 0px |
Medium | .md: | 768px |
Large | .lg: | 1280px |
# Colors
The following colors are used in vdlcss. All colors can be edited via CSS variables.
bg-red white
bg-green white
bg-blue white
bg-yellow white
bg-white black
bg-gray white
bg-black white
For different color schemes, there are also the following two classes: color-scheme
and color-scheme-contrast
. They can be used as a replacement for black
and white
color classes. If the current color scheme is dark, then color-scheme
will be set to black
and color-scheme-contrast
to white
. Vice versa for light color schemes.
# Text
There are only a handful of classes to style text.
text-left
text-right
text-center
uppercase
# Border
To add borders and color them, use the following classes.
border
border-top
border-right
border-bottom
border-left
border rounded
border unrounded
border border-red
hover-border
You can also change the width of a border with border-2
.
border border-2 border-color-scheme-contrast
Note: All colors are supported.
# Lists
Adding the unstyled
class to an ul
or ol
will remove the default list styling.
- List item 1
- List item 2
- List item 3
- List item 4
<ul class="p-1 bg-white rounded black unstyled">
<li>List item 1</li>
<li>List item 2</li>
<li>List item 3</li>
<li>List item 4</li>
</ul>
This makes it easy to create a horizontal list for a navigation by adding the row
class as well.
- Item 1
- Item 2
- Item 3
- Item 4
<ul class="p-1 bg-white rounded black unstyled row">
<li class="mr-1">Item 1</li>
<li class="mr-1">Item 2</li>
<li class="mr-1">Item 3</li>
<li class="mr-1">Item 4</li>
</ul>
# Form and Buttons
# Shadow
Adding the shadow
class to an element will add a shadow to the element.
shadow
hover-shadow
shadow shadow-strong
hover-shadow shadow-strong
# Container
The container
class is used to center an element and restrict its width according to the current viewport. It also adds padding to the sides.
Breakpoint | Container max-width |
---|---|
Mobile | 100% |
Tablet | 720px |
Desktop | 1140px |
Note: For more information, take a look at the viewports.
# Grid
The grid
class is used to arrange elements in a grid. It is a 12-column system, which you can easily utilize with the following classes.
cell-12 md:cell-6
cell-6 md:cell-3
cell-6 md:cell-3
cell-12 md:cell-4
cell-12 md:cell-8
You can also use column-start-x
and column-end-x
, row-start-x
and row-end-x
. x
ranges from 1
to 13
.
column-start-1 column-end-8
column-start-5 column-end-13
column-start-7 column-end-13
# Rows and columns
Rows and columns are used to position elements using flex without too much typing.
Classes like justify-start, justify-end, align-start, align-end and center can be used to arrange your elements within columns and rows.
Rows
Row - justify-start
Row - justify-end
Row - between
Row - evenly
Row - around
Row - justify-center
Row - center
Row - align-start
Row - align-end
Row - align-center
Columns
Column - justify-start
Column - justify-end
Column - between
Column - evenly
Column - around
Column - justify-center
Column - center
Column - align-start
Column - align-end
Column - align-center
Note: Some classes support the viewport prefixes: row
, column
, cell-X
, justify-X
and align-X
.
# Positioning
For positioning the following classes are available: relative
, absolute
, fixed
, sticky
. You can position an absolute or fixed element within a relative container with top-X
, bottom-X
, left-X
, right-X
. X
ranges from 0
to 5
# Display
You can change the display type of an element with block
, inline-block
and inline
.
# Scroll and scrollbar
Scrolling can be allowed with either scroll-x
, scroll-y
or with snap, scroll-x-snap
, scroll-y-snap
. If you do not want any overflow, then use overflow-hidden
.
Scrollbars are styled by default. To change the colors, take a look at the CSS variables.
To allow smooth scroll, add scroll-smooth
to the wrapper element. For smooth scroll on the whole site, you will need to add it on the html
tag.
# Padding and margin
There are quite a few classes for padding and margin. They all follow the same pattern, a prefix followed by a value.
The values always range from 0
to 5
, with two extra values being 025
and 05
.
Valid prefixes are p
, m
, pt
, pr
, pb
, pl
, mt
, mr
, mb
and ml
.
p
always means padding and m
means margin. t
means top, r
means right, b
means bottom and l
means left.
You can also use px
and py
for horizontal and vertical padding and mx
and my
for horizontal and vertical margin.
For margin there are also the extra classes ml-auto
, mr-auto
and mx-auto
to set the margin to auto
.
Note: All of the classes support the viewport prefixes, except for margin auto.
# Width and height
You can set width and height with the w-100
, h-100
, w-auto
and h-auto
classes.
Note: All of the classes support the viewport prefixes.
# Hover effects
There are a few options to add effects when hovering over an element.
You can also add small animations by adding hover-zoom
or hover-lift
to the wrapper:
You can use the transition-25
and transition-5
class to change the transition duration to .25s or .5s. This is needed if you want to combine hover effects.
# Dialogs
Dialogs are used to display information to the user. vdlcss only adds basic styles. You will still need to add a small script to implement it.
<dialog id="example-dialog">
<h3>Example dialog</h3>
<form method="dialog">
<button class="m-0">Close</button>
</form>
</dialog>
<script>
function openExampleDialog() {
document.querySelector('#example-dialog').showModal();
}
</script>
<button
class="mt-1 outline"
onclick="openExampleDialog()">
Show Dialog
</button>
# CSS variables
Below you can find a complete list of all integrated CSS variables.
Variable name | Default value |
---|---|
--font-sans | Arial, Helvetica, sans-serif |
--font-serif | Georgia, 'Times New Roman', Times, serif |
--font-mono | 'Courier New', Courier, monospace |
--red | #c54047 |
--green | #79c037 |
--blue | #3e7dc0 |
--yellow | #c0b73e |
--gray | #898989 |
--black | #242424 |
--white | #f1f1f1 |
--primary | var(--blue) |
--primary-dark | #2b5786 |
--primary-light | #77a4d3 |
--color-scheme | var(--black) |
--color-scheme-contrast | var(--white) |
--link-color | var(--primary-light) |
--link-hover-color | var(--primary) |
--scrollbar-fg | var(--primary) |
--scrollbar-bg | #F5F5F5 |
--dialog-color | var(--color-scheme-contrast) |
--dialog-background-color | var(--color-scheme) |
--button-color | var(--color-scheme) |
--button-background | var(--color-scheme-contrast) |
--button-border-color | var(--color-scheme-contrast) |
--button-border-radius | 3px |
--button-hover-color | var(--color-scheme) |
--button-hover-background | var(--color-scheme-contrast) |
--button-hover-border-color | var(--color-scheme) |
--border-color | var(--color-scheme) |
--shadow | rgba(0, 0, 0, 0.24) 0px 3px 8px |