Skip to content

Commit 46d815a

Browse files
authored
Update README.md
1 parent 322b8ca commit 46d815a

File tree

1 file changed

+39
-6
lines changed

1 file changed

+39
-6
lines changed

README.md

Lines changed: 39 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -58,8 +58,40 @@ Use whatever you'd like, but there's a few advantages with this approach over Ta
5858
* Try tools like- Auto complete styles: [VSCode](https://code.visualstudio.com/) or [Sublime](https://packagecontrol.io/packages/Emmet). Auto fold `<style>` and `<script>` in [Sublime](https://packagecontrol.io/packages/Inline%20Fold)
5959
* These are not for everybody, but you may find them worthwhile.
6060

61-
## 👁️ CSS Scope Inline vs Tailwind CSS
62-
Example using CSS variables and child styling.
61+
## 👁️ CSS Scope Inline vs Tailwind CSS Showdowns
62+
### Basics
63+
```html
64+
<!-- CSS Scoped Inline -->
65+
<div>
66+
<style>
67+
.me { background: red; }
68+
.me div { background: green; }
69+
.me div[n1] { background: yellow; }
70+
.me div[n2] { background: blue; }
71+
</style>
72+
red
73+
<div>green</div>
74+
<div>green</div>
75+
<div>green</div>
76+
<div n1>yellow</div>
77+
<div n2>blue</div>
78+
<div>green</div>
79+
<div>green</div>
80+
</div>
81+
82+
<!-- Tailwind -->
83+
<div class="bg-[red]">
84+
red
85+
<div class="bg-[green]">green</div>
86+
<div class="bg-[green]">green</div>
87+
<div class="bg-[green]">green</div>
88+
<div class="bg-[yellow]">yellow</div>
89+
<div class="bg-[blue]">blue</div>
90+
<div class="bg-[green]">green</div>
91+
<div class="bg-[green]">green</div>
92+
</div>
93+
```
94+
### CSS variables and child styling
6395

6496
```html
6597
<!doctype html>
@@ -76,10 +108,11 @@ Example using CSS variables and child styling.
76108
<body>
77109
<!-- CSS Scope Inline -->
78110
<div>
79-
<style>.me { margin:8px 6px;
80-
& a { display:block; padding:8px 12px; margin:10px 0; background:var(--color-1); border-radius:10px; text-align:center; }
81-
& a:hover { background:var(--color-1-active); color:white; }
82-
}</style>
111+
<style>
112+
.me { margin:8px 6px; }
113+
.me a { display:block; padding:8px 12px; margin:10px 0; background:var(--color-1); border-radius:10px; text-align:center; }
114+
.me a:hover { background:var(--color-1-active); color:white; }
115+
</style>
83116
<a href="#">Home</a>
84117
<a href="#">Team</a>
85118
<a href="#">Profile</a>

0 commit comments

Comments
 (0)