Skip to content

Commit 3ee4d87

Browse files
authored
Update example.html
1 parent 1460a5e commit 3ee4d87

File tree

1 file changed

+26
-26
lines changed

1 file changed

+26
-26
lines changed

example.html

Lines changed: 26 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -24,30 +24,30 @@
2424

2525
<div>
2626
<style> /* Simple example. */
27-
.me { margin: 20px; }
28-
.me div { font-size: 5rem; }
27+
me { margin: 20px; }
28+
me div { font-size: 5rem; }
2929
</style>
3030
<div>👻</div>
3131
</div>
3232

3333
<div>
3434
<style>
3535
/* Flat, 1 selector style. Really easy. We recommend it! */
36-
.me { font-family: 'Noto Sans', sans-serif; background: hsl(264 62% 20%); color: #fff; }
37-
.me ol { padding: 5px 0; }
38-
.me ol li { list-style: disc; padding: 4px; border-radius: 12px; margin: 4px 20px }
39-
/* ✨ .this and .self alias .me */
40-
.this ol li[n1] { background: hsl(264 50% 50%) }
41-
.self ol li[n2] { background: hsl(264 80% 50%) }
36+
me { font-family: 'Noto Sans', sans-serif; background: hsl(264 62% 20%); color: #fff; }
37+
me ol { padding: 5px 0; }
38+
me ol li { list-style: disc; padding: 4px; border-radius: 12px; margin: 4px 20px }
39+
/* ✨ this and self alias me */
40+
this ol li[n1] { background: hsl(264 50% 50%) }
41+
self ol li[n2] { background: hsl(264 80% 50%) }
4242
/* Nested, 1 selector style. Possible! But visually busy. */
43-
.me { border:none; border-radius: 12px; box-shadow: 0 2px 5px #00000044; padding: 10px 20px; margin: 20px;
43+
me { border:none; border-radius: 12px; box-shadow: 0 2px 5px #00000044; padding: 10px 20px; margin: 20px;
4444
& span { background: hsl(264 90% 90%); color: hsl(264 30% 40%); padding: 16px 20px; border-radius: 8px; box-shadow: 0 0 5px hsl(0 0% 0% / 20%);
4545
&::before { content:'🔮'; padding: 0 1ch 0 0; }
4646
}
4747
}
4848
/* Animations */
49-
.me { animation: \.me 2s ease-in-out infinite }
50-
@keyframes \.me { /* ♻️ Looped animation @keyframes can be scoped using \ */
49+
me { animation: \me 2s ease-in-out infinite }
50+
@keyframes \me { /* ♻️ Looped animation @keyframes can be scoped using \ */
5151
0% { transform: translateY(0px); }
5252
50% { transform: translateY(20px); }
5353
100% { transform: translateY(0px); }
@@ -68,29 +68,29 @@ <h1>🛸 Scoped style using .me</h1>
6868
<div>
6969
<style>
7070
/* Scoped CSS variables work fine! */
71-
.me { --color: hsl(264 80% 50%); font-family: sans-serif; margin: 20px }
72-
.me div { margin: 20px 0 }
73-
.me div ul { margin: 0; padding: 0 }
74-
.me div ul li { display: inline-block; width: 110px; text-align: center; background: #444; border-radius: 5px; padding: 10px 2px; margin: 10px 10px }
71+
me { --color: hsl(264 80% 50%); font-family: sans-serif; margin: 20px }
72+
me div { margin: 20px 0 }
73+
me div ul { margin: 0; padding: 0 }
74+
me div ul li { display: inline-block; width: 110px; text-align: center; background: #444; border-radius: 5px; padding: 10px 2px; margin: 10px 10px }
7575
</style>
7676
<h2>Responsive Design 🔛 Resize the window!</h2>
7777
🟢 = No breakpoint. Default.
7878
<div>
7979
<style>
80-
.me ul li[n1] { background: var(--color); }
81-
@media sm { .me ul li[n2] { background: var(--color); } }
82-
@media md { .me ul li[n3] { background: var(--color); } }
83-
@media lg { .me ul li[n4] { background: var(--color); } }
84-
@media xl { .me ul li[n5] { background: var(--color); } }
85-
@media xx { .me ul li[n6] { background: var(--color); } }
80+
me ul li[n1] { background: var(--color); }
81+
@media sm { me ul li[n2] { background: var(--color); } }
82+
@media md { me ul li[n3] { background: var(--color); } }
83+
@media lg { me ul li[n4] { background: var(--color); } }
84+
@media xl { me ul li[n5] { background: var(--color); } }
85+
@media xx { me ul li[n6] { background: var(--color); } }
8686
</style>
8787
<div>Mobile First (<strong>above</strong> breakpoint)</div>
8888
<ul><li n1><strong>🟢 None</strong><li n2>sm<li n3>md<li n4>lg<li n5>xl<li n6>🏁 xx</ul>
8989
</div>
9090
<div>
9191
<style>
9292
/* You can also nest @media styles! */
93-
.me ul li {
93+
me ul li {
9494
&[n1] { background: var(--color); }
9595
@media xl- { &[n2] { background: var(--color); } }
9696
@media lg- { &[n3] { background: var(--color); } }
@@ -109,15 +109,15 @@ <h2>HTMX Test</h2>
109109
<div>Swapped DOM elements are styled instantly when they arrive.</div>
110110
<button garlic hx-get="https://gnat.github.io/css-scope-inline/example.html" hx-select="button[garlic]" hx-swap="afterend">
111111
<style>
112-
.me { margin: 4px; padding: 10px 30px; min-width: 80px; background: hsl(264 80% 47%); border-bottom: 0.5rem solid hsl(264 80% 20%); }
113-
.me:hover { background: hsl(264 80% 60%); }
112+
me { margin: 4px; padding: 10px 30px; min-width: 80px; background: hsl(264 80% 47%); border-bottom: 0.5rem solid hsl(264 80% 20%); }
113+
me:hover { background: hsl(264 80% 60%); }
114114
</style>
115115
🧄
116116
</button>
117117
<button vampire hx-get="https://gnat.github.io/css-scope-inline/example.html" hx-select="button[vampire]" hx-swap="afterend">
118118
<style>
119-
.me { margin: 4px; padding: 10px 30px; min-width: 80px; background: hsl(150 80% 47%); border-bottom: 0.5rem solid hsl(150 80% 28%); }
120-
.me:hover { background: hsl(150 80% 60%); }
119+
me { margin: 4px; padding: 10px 30px; min-width: 80px; background: hsl(150 80% 47%); border-bottom: 0.5rem solid hsl(150 80% 28%); }
120+
me:hover { background: hsl(150 80% 60%); }
121121
</style>
122122
🧛
123123
</button>

0 commit comments

Comments
 (0)