@intergrav/dev.css 3.6.2 → 4.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +140 -30
- package/addon/header-oneline.css +14 -42
- package/addon/header-sticky.css +15 -7
- package/addon/scroll-to-top.js +2 -1
- package/dev.css +212 -186
- package/package.json +4 -5
- package/theme/boilerplate.user.css +30 -0
- package/theme/catppuccin-frappe.user.css +26 -0
- package/theme/catppuccin-macchiato.user.css +26 -0
- package/theme/catppuccin-mocha.user.css +26 -0
- package/theme/day.user.css +26 -0
- package/theme/night.user.css +26 -0
- package/theme/terminal.user.css +29 -0
- package/addon/header-sidebar.css +0 -97
- package/demo.html +0 -290
- package/theme/boilerplate-auto.css +0 -54
- package/theme/boilerplate.css +0 -23
- package/theme/catppuccin-frappe.css +0 -50
- package/theme/catppuccin-macchiato.css +0 -50
- package/theme/catppuccin-mocha.css +0 -50
- package/theme/day.css +0 -18
- package/theme/night.css +0 -18
- package/theme/terminal.css +0 -24
package/README.md
CHANGED
|
@@ -2,41 +2,141 @@
|
|
|
2
2
|
|
|
3
3
|
[](https://www.npmjs.com/package/@intergrav/dev.css) [](https://cdn.jsdelivr.net/npm/@intergrav/dev.css/) [](https://discord.gg/m5tUgaM3uK) [](https://github.com/intergrav/dev.css)
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
dev.css is a tiny, simple, classless CSS framework inspired by Vercel's [Geist](https://vercel.com/geist) design system. It is designed to make any plain HTML file look clean and modern. The minified stylesheet weighs only **~5.5kb** and includes both light and dark themes.
|
|
6
|
+
|
|
7
|
+
You can find the website at <a href="https://devcss.devins.page">devcss.devins.page</a>, which contains a demo page.
|
|
6
8
|
|
|
7
9
|
<details>
|
|
8
10
|
<summary>Click to view preview</summary>
|
|
9
|
-
<img src="
|
|
10
|
-
<img src="
|
|
11
|
-
<img height="748px" src="
|
|
12
|
-
<img height="748px" src="
|
|
11
|
+
<img src=".github/static/preview-desktop-light.png" alt="dev.css desktop demo, light mode">
|
|
12
|
+
<img src=".github/static/preview-desktop-dark.png" alt="dev.css desktop demo, dark mode">
|
|
13
|
+
<img height="748px" src=".github/static/preview-mobile-light.png" alt="dev.css mobile demo, light mode">
|
|
14
|
+
<img height="748px" src=".github/static/preview-mobile-dark.png" alt="dev.css mobile demo, dark mode">
|
|
13
15
|
</details>
|
|
14
16
|
|
|
17
|
+
## Who is this for?
|
|
18
|
+
|
|
19
|
+
dev.css is a great choice for:
|
|
20
|
+
|
|
21
|
+
- A simple blog
|
|
22
|
+
- A simple "about me" website
|
|
23
|
+
- Collecting your most used links
|
|
24
|
+
- Prototyping your raw HTML
|
|
25
|
+
|
|
26
|
+
dev.css was not meant for very complex websites. Although, if you need something more complex, you could build from/modify this stylesheet for your website. An example of a site that uses dev.css is [SkywardMC's wiki](https://skywardmc.org).
|
|
27
|
+
|
|
15
28
|
## Importing
|
|
16
29
|
|
|
17
30
|
To use dev.css in your HTML, simply add the following line to the `<head>` section of your HTML file:
|
|
18
31
|
|
|
19
32
|
```html
|
|
20
|
-
<link
|
|
33
|
+
<link
|
|
34
|
+
rel="stylesheet"
|
|
35
|
+
href="https://cdn.jsdelivr.net/npm/@intergrav/dev.css@4"
|
|
36
|
+
/>
|
|
21
37
|
```
|
|
22
38
|
|
|
23
|
-
You can also
|
|
39
|
+
You can also load a font from [intergrav/fonts](https://github.com/intergrav/fonts#readme) (or anywhere else) if you'd like a consistent font. Geist and Inter fonts work with dev.css out of the box, other fonts will require a theme to be used. If these fonts are not available, the default system/browser sans-serif and monospace fonts will be used, such as Microsoft's Segoe UI or Apple's San Francisco.
|
|
24
40
|
|
|
25
|
-
## Elements
|
|
41
|
+
## Elements and Structure
|
|
26
42
|
|
|
27
43
|
dev.css takes advantage of semantic HTML elements. Here are some guidelines on how to use them for the best results.
|
|
28
44
|
|
|
29
45
|
### Header
|
|
30
46
|
|
|
31
|
-
|
|
47
|
+
It's recommended that you add a header to your page. To add one, place a `<header>` tag at the top of your `<body>`. You can use an `<h1>` tag as your website's title. You can also add a `<p>` element as an optional short description of the site.
|
|
48
|
+
|
|
49
|
+
If you want to add a traditional navigation element, you should lay out your `<nav>` element like this:
|
|
50
|
+
|
|
51
|
+
```html
|
|
52
|
+
<header>
|
|
53
|
+
<h1>Website Title</h1>
|
|
54
|
+
<p>An optional description of the website.</p>
|
|
55
|
+
<nav>
|
|
56
|
+
<ul>
|
|
57
|
+
<li><a href="https://example.com">Demo</a></li>
|
|
58
|
+
<li><a href="https://example.com">GitHub</a></li>
|
|
59
|
+
<li><a href="https://example.com">npm</a></li>
|
|
60
|
+
<li><a href="https://example.com">jsDelivr</a></li>
|
|
61
|
+
</ul>
|
|
62
|
+
</nav>
|
|
63
|
+
</header>
|
|
64
|
+
```
|
|
65
|
+
|
|
66
|
+

|
|
32
67
|
|
|
33
|
-
If you
|
|
68
|
+
If you'd like, you could instead use [breadcrumb navigation](https://en.wikipedia.org/wiki/Breadcrumb_navigation). If you're using the header-oneline addon while doing this, it's recommended to remove all other elements in the header and move `<h1>` to `<main>`.
|
|
69
|
+
|
|
70
|
+
```html
|
|
71
|
+
<header>
|
|
72
|
+
<nav>
|
|
73
|
+
<a href="../..">dev.css</a> / <a href="..">Blog</a> / Making a Website
|
|
74
|
+
</nav>
|
|
75
|
+
<h1>Making a Website</h1>
|
|
76
|
+
<p>Making a basic website with dev.css.</p>
|
|
77
|
+
</header>
|
|
78
|
+
```
|
|
79
|
+
|
|
80
|
+

|
|
81
|
+
|
|
82
|
+
### Main
|
|
83
|
+
|
|
84
|
+
For your main content, or the actual content of the page, it is heavily recommended that you wrap all of it in a `<main>` tag. Otherwise, certain features from dev.css may not work properly. It may also benefit search engine optimization. Here's an example:
|
|
85
|
+
|
|
86
|
+
```html
|
|
87
|
+
<main>
|
|
88
|
+
<h1>Page 1</h1>
|
|
89
|
+
<p>Welcome to my website's first page! This is an example.</p>
|
|
90
|
+
</main>
|
|
91
|
+
```
|
|
34
92
|
|
|
35
|
-
|
|
93
|
+
### Sidebar
|
|
94
|
+
|
|
95
|
+
Optionally, you can add a sidebar to your page for pretty much anything you'd like. A good usage for this could be, for example, complex navigation on a docs website, where you wouldn't be able to fit it all into the header. The sidebar will sort normally with the rest of the content on smaller screens. To make a sidebar, place an `<aside>` tag, and then put an `<article>` inside. You must put it above the `<main>` content. You can have up to two sidebars per page - the second one will appear on the right side. Here's an example:
|
|
96
|
+
|
|
97
|
+
```html
|
|
98
|
+
<aside>
|
|
99
|
+
<article>
|
|
100
|
+
<h1>Sidebar</h1>
|
|
101
|
+
<nav>
|
|
102
|
+
<ul>
|
|
103
|
+
<li><a href="https://example.com">Page 1</a></li>
|
|
104
|
+
<li>
|
|
105
|
+
<a href="https://example.com">Page 2</a>
|
|
106
|
+
<ul>
|
|
107
|
+
<li><a href="https://example.com">Page 2.1</a></li>
|
|
108
|
+
<li><a href="https://example.com">Page 2.2</a></li>
|
|
109
|
+
</ul>
|
|
110
|
+
</li>
|
|
111
|
+
<li><a href="https://example.com">Page 3</a></li>
|
|
112
|
+
<li><a href="https://example.com">Page 4</a></li>
|
|
113
|
+
</ul>
|
|
114
|
+
</nav>
|
|
115
|
+
</article>
|
|
116
|
+
</aside>
|
|
117
|
+
```
|
|
36
118
|
|
|
37
119
|
### Footer
|
|
38
120
|
|
|
39
|
-
Optionally,
|
|
121
|
+
Optionally, you can add a footer to your page. This could include copyright information, what the website was built with, it's source link, anything really. To make a footer, place a `<footer>` tag at the bottom of your `<body>`. It also formats the nav element in the same way that the header does.
|
|
122
|
+
|
|
123
|
+
### Final Structure
|
|
124
|
+
|
|
125
|
+
In the end, this is what your page structure should look like if you decide to add everything:
|
|
126
|
+
|
|
127
|
+
```html
|
|
128
|
+
<html>
|
|
129
|
+
<head>
|
|
130
|
+
...
|
|
131
|
+
</head>
|
|
132
|
+
<body>
|
|
133
|
+
<header>...</header>
|
|
134
|
+
<aside>...</aside>
|
|
135
|
+
<main>...</main>
|
|
136
|
+
<footer>...</footer>
|
|
137
|
+
</body>
|
|
138
|
+
</html>
|
|
139
|
+
```
|
|
40
140
|
|
|
41
141
|
### Text
|
|
42
142
|
|
|
@@ -71,28 +171,26 @@ To learn about other HTML elements and how to write HTML, visit [W3Schools/html]
|
|
|
71
171
|
|
|
72
172
|
dev.css provides a basic set of styles. Addons are small CSS or JS snippets that can be used to adjust or add functionality to dev.css based on your needs. Here are the built-in addons.
|
|
73
173
|
|
|
74
|
-
### `header-sticky.css`
|
|
75
|
-
|
|
76
|
-
This addon makes the header sticky, always staying at the top of the screen. Note that this addon is recommended for small headers, as it may affect the usability of your site if the header is large and takes up a lot of space. To use this addon, add the following line after the `dev.css` import:
|
|
77
|
-
|
|
78
|
-
```html
|
|
79
|
-
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/@intergrav/dev.css@3/addon/header-sticky.min.css">
|
|
80
|
-
```
|
|
81
|
-
|
|
82
174
|
### `header-oneline.css`
|
|
83
175
|
|
|
84
|
-
This addon
|
|
176
|
+
This addon makes the header much more compact on narrow viewports. To use, add the following line after the `dev.css` import:
|
|
85
177
|
|
|
86
178
|
```html
|
|
87
|
-
<link
|
|
179
|
+
<link
|
|
180
|
+
rel="stylesheet"
|
|
181
|
+
href="https://cdn.jsdelivr.net/npm/@intergrav/dev.css@4/addon/header-oneline.min.css"
|
|
182
|
+
/>
|
|
88
183
|
```
|
|
89
184
|
|
|
90
|
-
### `header-
|
|
185
|
+
### `header-sticky.css`
|
|
91
186
|
|
|
92
|
-
This addon
|
|
187
|
+
This addon makes the header sticky, always staying at the top of the screen. Note that this addon is recommended for small headers, as it may affect the usability of your site if the header is large and takes up a lot of space. If using with `header-oneline.css`, place this after. To use, add the following line after the `dev.css` import:
|
|
93
188
|
|
|
94
189
|
```html
|
|
95
|
-
<link
|
|
190
|
+
<link
|
|
191
|
+
rel="stylesheet"
|
|
192
|
+
href="https://cdn.jsdelivr.net/npm/@intergrav/dev.css@4/addon/header-sticky.min.css"
|
|
193
|
+
/>
|
|
96
194
|
```
|
|
97
195
|
|
|
98
196
|
### `scroll-to-top.js`
|
|
@@ -100,19 +198,31 @@ This addon turns the header into a sidebar on wide displays. The navigation item
|
|
|
100
198
|
This addon creates a small "scroll to top" button in the bottom right corner of your website when the user scrolls down. The button uses the default dev.css button style. The button is slightly opaque so that you can see it but it doesn't block the view. To use this addon, add the following line after the `dev.css` import:
|
|
101
199
|
|
|
102
200
|
```html
|
|
103
|
-
<script
|
|
201
|
+
<script
|
|
202
|
+
src="https://cdn.jsdelivr.net/npm/@intergrav/dev.css@4/addon/scroll-to-top.min.js"
|
|
203
|
+
defer
|
|
204
|
+
></script>
|
|
104
205
|
```
|
|
105
206
|
|
|
106
207
|
## Themes
|
|
107
208
|
|
|
108
|
-
dev.css supports custom colors and fonts through themes. You can find some pre-made themes in the `/theme` folder. To use a theme, simply apply it after the dev.css stylesheet. There are
|
|
209
|
+
dev.css supports custom colors and fonts through themes. You can find some pre-made themes in the `/theme` folder. To use a theme, simply apply it after the dev.css stylesheet. There are night and day themes, a set of Catppuccin themes, and a terminal theme. For example, to apply the terminal theme, add the following line after the `dev.css` import:
|
|
109
210
|
|
|
110
211
|
```html
|
|
111
|
-
<link
|
|
212
|
+
<link
|
|
213
|
+
rel="stylesheet"
|
|
214
|
+
href="https://cdn.jsdelivr.net/npm/@intergrav/dev.css@4/theme/terminal.user.min.css"
|
|
215
|
+
/>
|
|
112
216
|
```
|
|
113
217
|
|
|
114
|
-
If you are creating
|
|
218
|
+
If you are creating your own theme, see the `boilerplate.user.css` file.
|
|
219
|
+
|
|
220
|
+
### Userstyles
|
|
221
|
+
|
|
222
|
+
The built-in themes can also be installed to your userstyle manager, such as Stylus. That theme will override any website using dev.css. To install one, open the theme's file in your browser.
|
|
115
223
|
|
|
116
224
|
## Credits
|
|
117
225
|
|
|
118
|
-
- [xz/new.css](https://github.com/xz/new.css)
|
|
226
|
+
- [xz/new.css](https://github.com/xz/new.css) being a major inspiration for this project
|
|
227
|
+
- Vercel's [Geist](https://vercel.com/geist/introduction) design system
|
|
228
|
+
- [Catppuccin](https://github.com/catppuccin) for the colors used in the Catppuccin themes
|
package/addon/header-oneline.css
CHANGED
|
@@ -1,50 +1,22 @@
|
|
|
1
|
-
/*
|
|
2
|
-
/* about:
|
|
3
|
-
/*
|
|
4
|
-
/* warn: i do not recommend using this if you have p or multiple nav elements in header */
|
|
5
|
-
|
|
6
|
-
header {
|
|
7
|
-
align-items: center;
|
|
8
|
-
display: flex;
|
|
9
|
-
}
|
|
10
|
-
|
|
11
|
-
header h1,
|
|
12
|
-
header h2,
|
|
13
|
-
header h3,
|
|
14
|
-
header h4,
|
|
15
|
-
header h5,
|
|
16
|
-
header h6 {
|
|
17
|
-
white-space: nowrap;
|
|
18
|
-
}
|
|
1
|
+
/* header-oneline for dev.css v4, a lightweight CSS framework - https://github.com/intergrav/dev.css */
|
|
2
|
+
/* about: makes the header much more compact by sorting horizontally, good with header-sticky addon */
|
|
3
|
+
/* note: will hide most elements in header other than img, h1-6, nav, and button */
|
|
19
4
|
|
|
20
5
|
header * {
|
|
6
|
+
font-size: 1rem;
|
|
7
|
+
line-height: 1;
|
|
21
8
|
margin: 0;
|
|
22
|
-
|
|
9
|
+
padding: 0;
|
|
10
|
+
margin-bottom: 0 !important;
|
|
23
11
|
}
|
|
24
12
|
|
|
25
|
-
header
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
header h2,
|
|
31
|
-
header h3,
|
|
32
|
-
header h4,
|
|
33
|
-
header h5,
|
|
34
|
-
header h6 {
|
|
35
|
-
color: var(--dc-tx-2);
|
|
36
|
-
font-weight: normal;
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
-
header h2::after,
|
|
40
|
-
header h3::after,
|
|
41
|
-
header h4::after,
|
|
42
|
-
header h5::after,
|
|
43
|
-
header h6::after {
|
|
44
|
-
content: "/";
|
|
13
|
+
header {
|
|
14
|
+
display: flex;
|
|
15
|
+
gap: 1rem;
|
|
16
|
+
padding: 0.75rem calc(50vw - 50%);
|
|
17
|
+
margin: 0 calc(50% - 50vw) 0;
|
|
45
18
|
}
|
|
46
19
|
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
font-size: 1rem !important;
|
|
20
|
+
header > *:not(img, h1, h2, h3, h4, h5, h6, nav, button) {
|
|
21
|
+
display: none;
|
|
50
22
|
}
|
package/addon/header-sticky.css
CHANGED
|
@@ -1,9 +1,17 @@
|
|
|
1
|
-
/*
|
|
2
|
-
/* about: makes the header sticky
|
|
3
|
-
/*
|
|
4
|
-
/* warn: i do not recommend using this if your header is large. may affect usability */
|
|
1
|
+
/* header-sticky for dev.css v4, a lightweight CSS framework - https://github.com/intergrav/dev.css */
|
|
2
|
+
/* about: makes the header sticky (when vh>24rem/vw>16rem). useful if the user needs to access nav often */
|
|
3
|
+
/* note: large sticky headers are bad for usability. too large? try header-oneline addon */
|
|
5
4
|
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
5
|
+
@media only screen and (min-height: 24rem) and (min-width: 16rem) {
|
|
6
|
+
header {
|
|
7
|
+
position: sticky;
|
|
8
|
+
top: 0;
|
|
9
|
+
background-color: var(--dc-bg-2);
|
|
10
|
+
}
|
|
11
|
+
@supports (backdrop-filter: blur(24px)) {
|
|
12
|
+
header {
|
|
13
|
+
backdrop-filter: blur(24px);
|
|
14
|
+
background: none;
|
|
15
|
+
}
|
|
16
|
+
}
|
|
9
17
|
}
|
package/addon/scroll-to-top.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/*
|
|
1
|
+
/* scroll-to-top for dev.css v4, a lightweight CSS framework - https://github.com/intergrav/dev.css */
|
|
2
2
|
/* about: shows a "scroll to top" button in the bottom right corner of the screen when scrolling */
|
|
3
3
|
|
|
4
4
|
const scrollToTopButton = document.createElement("button");
|
|
@@ -12,6 +12,7 @@ Object.assign(scrollToTopButton.style, {
|
|
|
12
12
|
right: "1rem",
|
|
13
13
|
width: "2.5rem",
|
|
14
14
|
height: "2.5rem",
|
|
15
|
+
"border-radius": "1.25rem",
|
|
15
16
|
});
|
|
16
17
|
document.body.appendChild(scrollToTopButton);
|
|
17
18
|
|