Skip to content

Commit aeef5d9

Browse files
committed
Update README
1 parent c6cdfe0 commit aeef5d9

1 file changed

Lines changed: 8 additions & 11 deletions

File tree

README.md

Lines changed: 8 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -15,20 +15,17 @@ A small (9 kB compressed) polyfill for CSS Container Queries using [`ResizeObser
1515

1616
## Getting Started
1717

18-
To use the polyfill, add this script tag to your document `<head>`:
18+
### Installation
1919

20-
```js
21-
<script>
22-
if (!("container" in document.documentElement.style)) {
23-
import("https://unpkg.com/container-query-polyfill@^0.2.0");
24-
}
25-
</script>
20+
```bash
21+
npm install --save container-query-polyfill
2622
```
2723

28-
You may also wish to use a service to conditionally deliver the polyfill based on `User-Agent`, or self-host it on your own origin.
24+
Alternatively, you can use it directly from a CDN:
2925

30-
> **Note**
31-
> All browsers have support for container queries released or on their roadmap, so it's recommended that you avoid bundling the polyfill with your other code.
26+
```js
27+
<script src="https://cdn.jsdelivr.net/npm/container-query-polyfill@0.2.4/dist/container-query-polyfill.modern.js"></script>
28+
```
3229

3330
For the best user experience, it's recommended that you initially only use the polyfill for content below-the-fold and use `@supports` queries to temporarily replace it with a loading indicator until the polyfill is ready to display it:
3431

@@ -53,7 +50,7 @@ You can view a more complete demo [here](https://codesandbox.io/s/smoosh-glitter
5350
## Limitations
5451

5552
- **CSS first**: The polyfill currently only supports `<style>` and same-origin `<link>` elements. Inline styles via the `style` attribute or CSSOM methods are not polyfilled. Likewise, JavaScript APIs like `CSSContainerRule` are not polyfilled, and APIs like `CSS.supports()` are not monkey-patched.
56-
- **Best effort**: Style changes that do not lead to observable DOM or layout mutations (e.g. changing `font-size` in a container without content) may not be detected, or may be detected a frame late on some browsers.
53+
- **Best effort**: Style changes that do not lead to observable DOM or layout mutations (e.g. changing `font-size` in a container without content) may not be detected, or may be detected a frame late on some browsers. [Complex sibling CSS selectors](https://github.com/GoogleChromeLabs/container-query-polyfill/issues/56) aren't supported.
5754
- Currently, there is no support for Shadow DOM, or functions like `calc(...)` in container conditions. Your contribution would be welcome!
5855

5956
## Supporting browsers without `:where()`

0 commit comments

Comments
 (0)