CSS now has an if() conditional function
11 days ago
- #JavaScript
- #HTML
- #CSS
- The `if()` CSS function allows setting different property values based on conditional tests (style, media, or feature queries).
- The `sandbox` attribute for iframes runs external pages with reduced privileges (e.g., no JavaScript).
- The `seamless` attribute for iframes (now removed from HTML5 specs) made iframe contents part of the page and adopted host styles.
- The `srcdoc` attribute overrides the `src` attribute content with inline HTML.
- The `loading` attribute enables lazy loading for images and iframes.
- `Element.scrollIntoViewIfNeeded()` scrolls an element into view if not already visible (proprietary variant of `scrollIntoView()`).
- Various `iframe` attributes control permissions (`allow`, `allowfullscreen`, etc.), security (`sandbox`, `csp`), and behavior (`loading`, `referrerpolicy`).
- HTTP headers like `If-Match`, `If-None-Match`, and `If-Range` handle conditional requests.
- JavaScript's `if...else` statement executes code based on conditions.