-
Notifications
You must be signed in to change notification settings - Fork 218
CSS at-rules demos #135
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
captainbrosset
merged 15 commits into
MicrosoftEdge:main
from
mikehoffms:user/mikehoffms/css-ref-codepens
May 20, 2026
Merged
CSS at-rules demos #135
Changes from all commits
Commits
Show all changes
15 commits
Select commit
Hold shift + click to select a range
9f40034
at-rules-at-scope
mikehoffms cc0784c
start 2nd dir/sample
mikehoffms 0c7bfa2
5 samples dirs
mikehoffms fc56082
5+1 Readmes
mikehoffms 3d605a3
finish demo 4 & 5 of 5 at-rules
mikehoffms a6be40a
add /focus/, /highlight/
mikehoffms cf4688b
/cascade-layers/
mikehoffms 756e601
Apply suggestions from code review
captainbrosset c06dfed
+3 rows; Open the demo:; sort rows
mikehoffms e8c1529
Formatting
captainbrosset 420b198
formatting
captainbrosset 4fbb085
Move and simplify emulate focused page demo
captainbrosset 1e12883
formatting
captainbrosset 280f5e9
link text
mikehoffms c828f3c
re-sort rows post rename
mikehoffms File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,5 @@ | ||
| # View `@font-palette-values` CSS at-rules | ||
|
|
||
| ➡️ Open the demo: **[View `@font-palette-values` at-rules](https://microsoftedge.github.io/Demos/at-rules-font-palette-values/)** ⬅️ | ||
|
|
||
| For instructions, see [View `@font-palette-values` at-rules](https://learn.microsoft.com/microsoft-edge/devtools/css/reference#view-font-palette-values-at-rules) in _CSS features reference_. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,17 @@ | ||
| <!DOCTYPE html> | ||
| <html lang="en"> | ||
|
|
||
| <head> | ||
| <meta charset="UTF-8"> | ||
| <meta name="viewport" content="width=device-width, initial-scale=1.0"> | ||
| <link rel="icon" type="image/png" href="https://edgestatic.azureedge.net/welcome/static/favicon.png"> | ||
| <title>View `@font-palette-values` at-rules</title> | ||
| <link rel="stylesheet" href="styles.css"> | ||
| </head> | ||
|
|
||
| <body> | ||
| <p>old colors</p> | ||
| <p class="new">new colors</p> | ||
| </body> | ||
|
|
||
| </html> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,17 @@ | ||
| @import url(https://fonts.googleapis.com/css2?family=Foldit:wght@700); | ||
|
|
||
| p { | ||
| font-family: 'Foldit'; | ||
| font-size: 2rem; | ||
| } | ||
|
|
||
| @font-palette-values --New { | ||
| font-family: 'Foldit'; | ||
| override-colors: | ||
| 0 gold, | ||
| 1 red; | ||
| } | ||
|
|
||
| .new { | ||
| font-palette: --New; | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,5 @@ | ||
| # View `@position-try` CSS at-rules | ||
|
|
||
| ➡️ Open the demo: **[View `@position-try` at-rules](https://microsoftedge.github.io/Demos/at-rules-position-try/)** ⬅️ | ||
|
|
||
| For instructions, see [View `@position-try` at-rules](https://learn.microsoft.com/microsoft-edge/devtools/css/reference#view-position-try-at-rules) in _CSS features reference_. | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,31 @@ | ||
| <!DOCTYPE html> | ||
| <html lang="en"> | ||
|
|
||
| <head> | ||
| <meta charset="UTF-8"> | ||
| <meta name="viewport" content="width=device-width, initial-scale=1.0"> | ||
| <link rel="icon" type="image/png" href="https://edgestatic.azureedge.net/welcome/static/favicon.png"> | ||
| <title>View `@position-try` at-rules</title> | ||
| <link rel="stylesheet" href="styles.css"> | ||
| </head> | ||
|
|
||
| <body> | ||
| <button popovertarget="menu" id="menu-btn">Your Account</button> | ||
|
|
||
| <ul role="nav" id="menu" popover> | ||
| <li><a href="#">View Profile</a></li> | ||
| <li><a href="#">Messages</a></li> | ||
| <li><a href="#">Favorites</a></li> | ||
| <li><a href="#">Account Settings</a></li> | ||
| <li> | ||
| <button popovertarget="submenu">Storefront <span class="arrow">➤</span></button> | ||
| <ul id="submenu" role="nav" popover> | ||
| <li><a href="#">Listings</a></li> | ||
| <li><a href="#">Special Offers</a></li> | ||
| <li><a href="#">Sign out</a></li> | ||
| </ul> | ||
| </li> | ||
| </ul> | ||
| </body> | ||
|
|
||
| </html> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,100 @@ | ||
| /* anchoring */ | ||
| [popovertarget="menu"] { | ||
| anchor-name: --menu; | ||
| } | ||
|
|
||
| [popovertarget="submenu"] { | ||
| anchor-name: --submenu; | ||
| } | ||
|
|
||
| #menu { | ||
| position: absolute; | ||
| margin: 0; | ||
| position-anchor: --menu; | ||
| left: anchor(--menu left); | ||
| top: anchor(--menu bottom); | ||
| } | ||
|
|
||
| #submenu { | ||
| position: absolute; | ||
| margin: 0; | ||
| position-anchor: --submenu; | ||
| left: anchor(--submenu right); | ||
| top: anchor(--submenu top); | ||
| margin-left: var(--padding); | ||
| position-try-fallbacks: --bottom; | ||
| transition: left 0.25s, top 0.25s; | ||
| width: max-content; | ||
| } | ||
|
|
||
| @position-try --bottom { | ||
| margin: var(--padding) 0 0 var(--padding); | ||
| left: anchor(--submenu left); | ||
| top: anchor(--submenu bottom); | ||
| margin-left: var(--padding); | ||
| } | ||
|
|
||
| [popovertarget="submenu"] { | ||
| width: 100%; | ||
| display: flex; | ||
| justify-content: space-between; | ||
| } | ||
|
|
||
| /* animating */ | ||
|
|
||
| /* etc */ | ||
| :root { | ||
| --padding: 1rem; | ||
| } | ||
|
|
||
| #menu, | ||
| #submenu { | ||
| padding: var(--padding); | ||
| background: skyblue; | ||
| gap: 1rem; | ||
| border: none; | ||
| } | ||
|
|
||
| #menu:popover-open, | ||
| #submenu:popover-open { | ||
| display: grid; | ||
| } | ||
|
|
||
| #menu-btn { | ||
| background: royalblue; | ||
| color: white; | ||
| padding: var(--padding); | ||
| } | ||
|
|
||
| #submenu { | ||
| background: lightblue; | ||
| } | ||
|
|
||
| li { | ||
| list-style: none; | ||
| padding: 0; | ||
| } | ||
|
|
||
| a, | ||
| button { | ||
| font-family: system-ui; | ||
| text-decoration: none; | ||
| font-size: 1rem; | ||
| padding: 0; | ||
| color: black; | ||
| text-transform: uppercase; | ||
| font-weight: 700; | ||
| letter-spacing: 0.2px; | ||
| border: none; | ||
| background: none; | ||
| } | ||
|
|
||
| .arrow { | ||
| transition: rotate 0.2s; | ||
| } | ||
|
|
||
| #menu:has(:popover-open) { | ||
| .arrow { | ||
| rotate: -90deg; | ||
| } | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,5 @@ | ||
| # View `@property` CSS at-rules | ||
|
|
||
| ➡️ Open the demo: **[View `@property` at-rules](https://microsoftedge.github.io/Demos/at-rules-property/)** ⬅️ | ||
|
|
||
| For instructions, see [View `@property` at-rules](https://learn.microsoft.com/microsoft-edge/devtools/css/reference#view-property-at-rules) in _CSS features reference_. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,20 @@ | ||
| <!DOCTYPE html> | ||
| <html lang="en"> | ||
|
|
||
| <head> | ||
| <meta charset="UTF-8"> | ||
| <meta name="viewport" content="width=device-width, initial-scale=1.0"> | ||
| <link rel="icon" type="image/png" href="https://edgestatic.azureedge.net/welcome/static/favicon.png"> | ||
| <title>View `@property` at-rules</title> | ||
| <link rel="stylesheet" href="styles.css"> | ||
| </head> | ||
|
|
||
| <body> | ||
| <ol> | ||
| <li class="one">Item one</li> | ||
| <li class="two">Item two</li> | ||
| <li class="three">Item three</li> | ||
| </ol> | ||
| </body> | ||
|
|
||
| </html> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,33 @@ | ||
| @property --itemSize { | ||
| syntax: "<length> | <percentage>"; | ||
| inherits: true; | ||
| initial-value: 200px; | ||
| } | ||
|
|
||
| @property --borderWidth { | ||
| syntax: "<length>"; | ||
| inherits: false; | ||
| initial-value: 10px; | ||
| } | ||
|
|
||
| ol { | ||
| --itemSize: 100px; | ||
| --borderWidth: 1px; | ||
| } | ||
|
|
||
| .two { | ||
| --itemSize: initial; | ||
| --borderWidth: inherit; | ||
| } | ||
|
|
||
| .three { | ||
|
captainbrosset marked this conversation as resolved.
|
||
| --itemSize: large; | ||
| --borderWidth: 3%; | ||
| } | ||
|
|
||
| li { | ||
| width: var(--itemSize); | ||
| border: var(--borderWidth) solid red; | ||
| background-color: yellow; | ||
| margin-bottom: 10px; | ||
| } | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,5 @@ | ||
| # View `@scope` CSS at-rules | ||
|
|
||
| ➡️ Open the demo: **[View `@scope` at-rules](https://microsoftedge.github.io/Demos/at-rules-scope/)** ⬅️ | ||
|
|
||
| For instructions, see [View `@scope` at-rules](https://learn.microsoft.com/microsoft-edge/devtools/css/reference#view-scope-at-rules) in _CSS features reference_. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,19 @@ | ||
| <!DOCTYPE html> | ||
| <html lang="en"> | ||
|
|
||
| <head> | ||
| <meta charset="UTF-8"> | ||
| <meta name="viewport" content="width=device-width, initial-scale=1.0"> | ||
| <link rel="icon" type="image/png" href="https://edgestatic.azureedge.net/welcome/static/favicon.png"> | ||
| <title>View `@scope` at-rules</title> | ||
| <link rel="stylesheet" href="styles.css"> | ||
| </head> | ||
|
|
||
| <body> | ||
| <p>I'm just a piece of text.</p> | ||
| <div class="card"> | ||
| <p>I'm the text that lives on a card.</p> | ||
| </div> | ||
| </body> | ||
|
|
||
| </html> |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.