57 | Blunt is designed to make creating page layouts a easy. It provides a host of general CSS classes to position elements, add padding and margins to elements, create responsive grids, and more.
58 | It has no opinions on how your page should look. This means that you won't have to fight with Blunt to overwrite default colors and button styles. All of that is left up to you.
59 |
60 |
61 | You can find Blunt on GitHub
62 | and join the discussion on Gitter.
63 |
64 |
65 |
66 | Getting Started
67 |
68 | Include Blunt into your project with the this single line of code.
69 |
88 | With the exception of the container class, all classes in Blunt follow the same structure.
89 |
90 |
91 | {size}-{className}-{value}
92 |
93 |
94 | Where {size} is replaced with a screen size lg, md, or sm, {className} is replaced with the specific Blunt class and {value} is replaced with a number.
95 |
96 |
97 |
98 | Blunt currently supports three screen sizes sm (max width 900px) md (max width 1500px) and lg (min width 1500px)
99 |
100 |
101 |
102 | As a practical example, let's say we wanted to add padding to the top of an element.
103 | If we wanted to do this for all screen sizes we would do this.
104 |
105 |
106 |
<div class="pt-1">
107 |
108 |
109 | If we wanted to have this padding on only spall screens (screen size < 900px) we would do the following
110 |
111 |
112 |
<div class="sm-pt-1">
113 |
114 |
The padding class along with some other classes also support decimal values using the notation
{number}p{fraction}
115 |
116 |
So if we wanted to add, say, a padding of 1.3 to the top of an element we could do the following.
117 |
118 |
<div class="pt-1p3">
119 |
120 | Container
121 |
122 |
The container class creates an element with responsive width.
123 |
124 |
<div class="container">
125 | Other stuff
126 | </div>
127 |
128 | Width and Height
129 |
130 |
Blunt provides 3 different width and height classes
131 |
{h,w}-{1-100}, px{h,w}-{1-1000} and v{h,w}-{1-100}
132 |
133 |
<div class="w-50">
134 |
135 |
136 | Makes the div's width 50%
137 |
138 |
139 |
<div class="vh-50">
140 |
141 |
142 | Makes the div's height 50vh
143 |
144 |
145 |
<div class="md-pxw-500">
146 |
147 |
148 | Makes the div's width 500px on medium sized screens
149 |
150 | Margin and Padding
151 |
152 |
The following padding and margin classes are provided
153 |
{m,p}{l,r,t,b}-{0-15}p{1-9}
154 |
155 |
<div class="mt-5">
156 |
157 |
Adds a top margin of 5vh to the div
158 |
<div class="pl-3">
159 |
Adds a padding left of 3vw to the div
160 |
<div class="sm-mb-2p5">
161 |
Adds a margin of 2.5vh to the div on small screens
162 |
<div class="md-pr-10">
163 |
Adds a padding right of 10vw to the div on medium screens
164 |
165 | Row and Col
166 | Grid
167 | Font and Line Height
168 | Positioning
169 |
170 |
171 | Simple Card
172 |
173 |
174 |
175 |
176 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | # Blunt
2 |
3 | [Join the Discord](https://discord.gg/EZJEwsP)
4 |
5 | Version: 1.1.0
6 |
7 | A CSS framework without all the fluff.
8 |
9 | Blunt doesn't have any opinions on how your applications should look. It only provides helper classes to make positioning and responsive design easier.
10 |
11 | # Why another CSS framework...?
12 |
13 | There seem to be hundreds of these things out there. So why bother with another one?
14 | Well, I was sick of fighting with the other options. Most are overly opinionated and result in spending time
15 | fighting the framework instead of it boosting productivity. I have tried so many different ones. Some do too
16 | much, others do too little. I needed some middle ground that worked for _specifically_ what I wanted. I don't want to write any CSS
17 | that does positioning elements. I want to write CSS that only does the _styling_ of my elements (e.g. text color, borders, background colors, etc).
18 |
19 | That means that I never want to write `display: flex;` or `display: grid;` but I have no problem writing `color: var(--off-white);`.
20 |
21 | I also never want to write another `@media` query again. I want all of my positioning code to get done within the HTML itself.
22 |
23 | I also don't want something that does more than this. I don't want to have to install an NPM package to get what I need.
24 | I just want to include the CSS file and be done with it.
25 |
26 | As a result, Blunt does the following:
27 |
28 | 1. Provides a responsive container for 3 different screen sizes (sm, md, lg)
29 | 2. Provides margin classes
30 | 3. Provides padding classes
31 | 4. Provides width classes
32 | 5. Provides height classes
33 | 6. Provides font size and line height classes
34 | 7. Provides grid classes
35 | 8. Provides a row and column class
36 | 9. Provides classes to align text and elements
37 | 10. Never requires me to write CSS for positioning.
38 |
39 | It does nothing else.
40 |
41 | # Getting Started
42 |
43 | Simply add the following line to your HTML file.
44 |
45 | ```
46 |
47 | ```
48 |
49 | or install it through npm
50 |
51 | ```
52 | npm install blunt-css
53 | ```
54 |
55 | NOTE: Blunt is big at around 1mb minified. Along with standard gzip compression, it is highly suggested that in a production environment a tool like [purify-css](https://www.npmjs.com/package/purify-css) is used to minimize blunt as much as possible. There will be a noticable performance decrease if not.
56 |
57 | # Building the CSS
58 |
59 | Blunt is written in SCSS. To generate the CSS code clone the repo and run the following command:
60 |
61 | `sass src/blunt.scss blunt.css`
62 |
63 | or run
64 |
65 | `npm install`
66 | `npm run build`
67 |
68 | # Example
69 |
70 | Let's create a simple responsive card using Blunt.
71 |
72 | ```html
73 |
74 |
75 |
76 |
77 |
78 |
79 |
80 |
Erin May
81 |
Software Engineer
82 |
emay@example.com
83 |
(123) 456-7890
84 |
85 |
86 |
87 |
88 |
89 |
107 | ```
108 |
109 | Large
110 |
111 | 
112 |
113 | Medium
114 |
115 | 
116 |
117 | Small
118 |
119 | 
120 |
121 | # Classes
122 |
123 | Blunt supports three screen sizes:
124 |
125 | 1. `sm` which has a max width of 900px
126 | 2. `md` which has a max width of 1500px
127 | 3. `lg` which is anything above 1500px
128 |
129 | Blunt supports decimal values on some classes using the following syntax `{integer}p{fraction}` where `fraction` is a number from 1 to 9
130 |
131 | As an example, if we want to set the font size on a small screen we can use the class `sm-font-1p2` which will sent the font size on small screens to `1.2rem`
132 | If we want the font size to be 1.2rem on all screen sizes we can remove the `sm` and use the class `font-1p2`. Screen size specific classes override the global values for their respective screen sizes.
133 | Whole numbers do not use the `{number}p{fraction}` syntax. For a font size of `1rem` the following class is used: `font-1`.
134 |
135 | ### All Blunt classes
136 |
137 | `container` - Responsive container class
138 |
139 | `{size}-grid` - Sets display of element to `grid`
140 |
141 | `{size}-grid-h-center` - Center aligns grid items horizontally
142 |
143 | `{size}-grid-v-center` - Center aligns grid items vertically
144 |
145 | `{size}-grid-h-end` - Aligns grid items to their horizontal end
146 |
147 | `{size}-grid-v-end` - Aligns grid items to their vertical end
148 |
149 | `{size}-grid-{1-10}` - Defines number of columns in grid (between 1 and 10 columns)
150 |
151 | `{size}-gap-{0-4}p{1-9}` - Defines the grid gap between 0.1 and 4 rem
152 |
153 | `{size}-m{l,r,t,b}-auto` - Margin class `ml-auto` does `margin-left: auto`
154 |
155 | `{size}-auto-center, {size}-mx-auto` - Does `margin-left: auto; margin-right: auto;`
156 |
157 | `{size}-my-auto` - Does `margin-top: auto; margin-bottom: auto;`
158 |
159 | `{size}-text-{left, right, center}` - Aligns text in one of three locations: left, right, or center
160 |
161 | `{size}-m{t,l,r,b,x,y}-{0-15}p{0-9}` - Margin class `sm-mt-3p3` will resolve to `margin-top: 3.3vh` for the small screen size
162 |
163 | `{size}-p{t,l,r,b,x,y}-{0-15}p{0-9}` - Padding class `md-pl-3p3` will resolve to `padding-left: 3.3vw` for the medium screen size.
164 |
165 | `{size}-pxm{t,l,r,b,x,y}-{0-1000}` - Margin class `lg-pxmt-50` will resolve to `margin-top: 50px` for the large screen size.
166 |
167 | `{size}-pxp{t,l,r,b,x,y}-{0-1000}` - Padding class `sm-pxpl-25` will resolve to `padding-left: 25px` for the small screen size.
168 |
169 | NOTE: For padding Blunt also provides bidirectional padding and margin `px-`, `py-`, `mx-`, `my-`. `px-5` will resolve to `padding-left: 5vw; padding-right: 5vw;` and the equivalent for `mx-5`
170 |
171 | `{size}-lh-{0-4}p{0-9}` - Line height class `lg-lh-1p3` will resolve to `line-height: 1.3rem` for the large screen
172 |
173 | `{size}-font-{0-4}p{0-9}` - Font size class `font-2` will resolve to `font-size: 2rem;` for all screen sizes
174 |
175 | `{size}-w-{0-100}` - Width class `sm-w-80` will resolve to `width: 100%;` on small screens.
176 |
177 | `{size}-vw-{0-100}` - Width class `sm-vw-80` will resolve to `width: 100vw;` on small screens.
178 |
179 | `{size}-{min,max}-w-{0-100}` - Width calss `min-w-50` resolves to `min-width: 50%`
180 |
181 | `{size}-{min,max}-vw-{0-100}` - Width class `max-vw-50` resolves to `max-width: 50vw`
182 |
183 | `{size}-{min,max}-h-{0-100}` - Height calss `min-h-50` resolves to `min-height: 50%`
184 |
185 | `{size}-{min,max}-vh-{0-100}` - Height class `max-vh-50` resolves to `max-height: 50vw`
186 |
187 | `{size}-h-{0-100}` - Height class `md-h-100` will resolve to `height:100%;` on medium screens.
188 |
189 | `{size}-vh-{0-100}` - Height class `md-vh-100` will resolve to `height:100vh;` on medium screens.
190 |
191 | `{size}-row` - `sm-row` will resolve to `width: 100%; display: flex; flex-direction: row;` for small screens
192 |
193 | `{size}-col` - `lg-col` will resolve to `width: 100%; display: flex; flex-direction: column;` for large screens
194 |
195 | `{size}-{v, h, align, justify}-{start, center, end, inherit, initial, space-evenly, space-around, space-between}` - `lg-h-center` will center the row items horizontally on large screens
196 |
197 | `{size}-{wrap, no-wrap, wrap-reverse, wrap-initial, wrap-inherit}` - `sm-wrap` outputs `flex-wrap: wrap;` for small screens.
198 |
199 | `{size}-text-{center, left, right}` - `text-center` will center text
200 |
201 | `{size}-hidden` - `lg-hidden` will hide an element on large screens
202 |
203 | `{size}-px{w,h}-{0-1000}` - `lg-pxw-300` will resolve to `width: 300px` on large screens `md-pxh-200` will resolve to `height: 200px` on medium screens.
204 |
205 | `{size}-{min,max}-px{w, h}-{0-1000}` - `sm-min-pxw-600` resolves to `min-width: 600px` on small screens
206 |
207 | `{size}-{absolute, static, sticky, fixed}` - `lg-fixed` will resolve to `position: fixed;` for large screens
208 |
209 | `{size}-{top, left, right, bottom}-{1-100}` - `md-top-5` will resolve to `top:5vh;` for medium screens
210 |
--------------------------------------------------------------------------------