-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathindex.html
More file actions
145 lines (138 loc) · 4.54 KB
/
index.html
File metadata and controls
145 lines (138 loc) · 4.54 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
<!doctype html>
<html lang="en">
<head>
<!-- Google tag (gtag.js) -->
<script async src="https://www.googletagmanager.com/gtag/js?id=G-P73F0EQLS4"></script>
<script>
window.dataLayer = window.dataLayer || [];
function gtag(){dataLayer.push(arguments);}
gtag('js', new Date());
gtag('config', 'G-P73F0EQLS4');
</script>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>css-text demo</title>
<meta property="og:title" content="css-text demo" />
<meta
name="description"
content="Web Component to render text using CSS art while keep browser text a11y."
/>
<meta
property="og:description"
content="Web Component to render text using CSS art while keep browser text a11y."
/>
<meta name="keywords" content="css-text, css-art, web component" />
<link rel="canonical" href="https://maximeij.dev/css-text/" />
<meta name="author" content="Maxime IJ" />
<style>
html {
color-scheme: dark light;
font-size: 16px;
--hue: 89deg;
color: hsl(var(--hue), 15%, 95%);
background: hsl(var(--hue), 5%, 5%);
}
body {
margin: 0;
font-family: system-ui, sans-serif;
}
@property --transition-duration {
syntax: '<time>';
inherits: true;
initial-value: 0.25s;
}
@property --full-transition {
syntax: '<time>';
inherits: true;
initial-value: calc(var(--transition-duration) * 3) ease-out;
}
@property --fast-transition {
syntax: '<time>';
inherits: true;
initial-value: var(--transition-duration);
}
@property --delayed-transition {
syntax: '<time>';
inherits: true;
initial-value: 0.2s linear 0.1s;
}
@property --line-color {
syntax: '<color>';
inherits: true;
initial-value: white;
}
main {
height: 100vh;
max-width: 90rem;
margin: auto;
padding: 0 1vh;
display: grid;
place-content: center;
gap: 2vh;
grid-template-columns: minmax(13rem, 25rem) minmax(23rem, 1fr);
grid-template-rows: auto 0.9fr auto;
@media screen and (max-width: 600px) {
grid-template-columns: 1fr;
grid-template-rows: auto auto 1fr;
}
& > h1,
& > footer {
grid-column: 1 / -1;
text-align: center;
}
& > textarea {
min-height: 20vh;
padding: 1rem;
font-size: 1rem;
line-height: 200%;
background: hsl(var(--hue), 5%, 15%);
border: none;
border-radius: 0.5rem;
resize: none;
overflow: auto;
transition: background 0.2s;
&:focus {
background: hsl(var(--hue), 5%, 25%);
}
}
& > css-text#preview {
font-size: 2rem;
--transition-duration: 0.25s;
--full-transition: calc(var(--transition-duration) * 3) ease-out;
--fast-transition: var(--transition-duration);
--delayed-transition: calc(var(--transition-duration) * 2) ease-in-out var(--transition-duration);
--line-color: hsl(var(--hue), 15%, 95%);
&::part(letter) {
transition:
all var(--full-transition),
border-bottom-width var(--fast-transition),
border-left-width var(--fast-transition),
border-right-width var(--fast-transition),
border-top-width var(--fast-transition),
border-width var(--fast-transition),
border-bottom-color var(--fast-transition),
border-left-color var(--fast-transition),
border-right-color var(--fast-transition),
border-top-color var(--fast-transition),
border-color var(--fast-transition),
width var(--delayed-transition),
height var(--delayed-transition),
top var(--delayed-transition),
left var(--delayed-transition);
}
}
}
</style>
</head>
<body>
<main>
<h1><css-text class="monospace">CSS-TEXT DEMO</css-text></h1>
<textarea id="input"></textarea>
<css-text id="preview" class="monospace"></css-text>
<footer>
<a href="https://github.com/maximeij/css-text" target="_blank">Repository (Github)</a>
</footer>
</main>
<script type="module" src="./demo/main.ts" defer></script>
</body>
</html>