You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+50-34Lines changed: 50 additions & 34 deletions
Original file line number
Diff line number
Diff line change
@@ -27,47 +27,68 @@ module.exports = {
27
27
28
28
## Usage
29
29
30
+
Start by marking an element as a container using the `@container` class, and then applying styles based on the size of that container using the container variants like `@md:`, `@lg:`, and `@xl:`:
31
+
30
32
```html
31
-
<!-- Container queries without a specific container name -->
32
33
<divclass="@container">
33
-
<!-- Container query with a size of `lg` defined in your tailwind.config.js file -->
34
-
<divclass="@lg:underline"></div>
35
-
<divclass="@[1024px]:underline"></div>
34
+
<divclass="@lg:underline">
35
+
<!-- This text will be underlined when the container is larger than `32rem` -->
36
+
</div>
36
37
</div>
38
+
```
39
+
40
+
By default we provide [container sizes](#configuration) from `@xs` (`20rem`) to `@7xl` (`80rem`).
41
+
42
+
### Named containers
37
43
38
-
<!-- Container queries that apply for a defined container name -->
39
-
<divclass="@container/sidebar">
40
-
<divclass="@lg/sidebar:underline"></div>
41
-
<divclass="@[1024px]/sidebar:underline"></div>
44
+
You can optionally name containers using a `@container/{name}` class, and then include that name in the container variants using classes like `@lg/main:underline`:
45
+
46
+
```html
47
+
<divclass="@container/main">
48
+
<!-- ... -->
49
+
<divclass="@lg/main:underline">
50
+
<!-- This text will be underlined when the "main" container is larger than `32rem` -->
0 commit comments