It's nice to have a handy reference for CSS.
I'd highly recommend using the Mozilla Developer Network.
In case you ever wanted a scriptable reference for CSS, this page shows you how.
It extracts all of the reference links and outputs them into some handy table and a json file.
View Source
<#
.SYNOPSIS
CSS reference
.DESCRIPTION
CSS Reference Cheat Sheet
.NOTES
It's nice to have a handy reference for CSS.
I'd highly recommend using the [Mozilla Developer Network](https://developer.mozilla.org/en-US/docs/Web/CSS/Reference/Elements/).
In case you ever wanted a scriptable reference for CSS, this page shows you how.
It extracts all of the reference links and outputs them into some handy table and a json file.
#>
param()
if ($PSScriptRoot) { Push-Location $PSScriptRoot }
$myHelp = Get-Help $myInvocation.MyCommand.ScriptBlock.File
if ($page -is [Collections.IDictionary]) {
$page.Title = $title = $myHelp.Synopsis
$page.Description = $description = $myHelp.description.text -join [Environment]::NewLine
}
$myNotes = $myHelp.alertSet.alert.text
if ($myNotes) {
(ConvertFrom-Markdown -InputObject $myNotes).Html
}
"<details>"
"<summary>View Source</summary>"
"<pre><code class='language-powershell'>"
[Web.HttpUtility]::HtmlEncode($MyInvocation.MyCommand.ScriptBlock)
"</code></pre>"
"</details>"
if (-not $script:CssLinks) {
$script:CssLinks = Invoke-WebRequest https://developer.mozilla.org/en-US/docs/Web/CSS/ |
Select-Object -ExpandProperty Links |
Where-Object Href -match '/CSS' |
ForEach-Object {
$link = $_
$linkText = ($_.outerhtml -as [xml]).a.innerText
[PSCustomObject]@{
name = $linkText
href = $link = "https://developer.mozilla.org" + $link.href
}
} |
Sort-Object Name
}
$cssReferenceLinks = [Ordered]@{
'atRules' =
$script:CssLinks |
Where-Object Name -match '^\@'
'attributes' =
$script:CssLinks |
Where-Object Name -cmatch '^[\p{Ll}\-]+$' |
Where-Object Href -match '/CSS/[^/]+$'
'combinators' =
$script:CssLinks |
Where-Object Name -match '(?>Combinator|Selector List)' |
Where-Object Href -match '/CSS/[^/]+$'
'functions' =
$script:CssLinks |
Where-Object Name -match '\(\)$' |
Where-Object Name -NotMatch '^:'
'pseudoClasses' =
$script:CssLinks |
Where-Object Name -match '^:' |
Where-Object Name -NotMatch '^::'
'pseudoElements' =
$script:CssLinks |
Where-Object Name -match '^::'
'selectors' =
$script:CssLinks |
Where-Object Name -match 'Selector' |
Where-Object Name -notmatch 'Selector List' |
Where-Object Name -notmatch '^\p{P}' |
Where-Object Href -match '/CSS/[^/]+$'
'types' =
$script:CssLinks |
Where-Object Name -match '^<.+?>$'
}
ConvertFrom-Markdown -InputObject (
@(foreach ($referenceTopic in $cssReferenceLinks.Keys) {
"* $referenceTopic"
foreach ($referenceLink in $cssReferenceLinks[$referenceTopic]) {
" * [``$($referenceLink.Name)``]($($referenceLink.Href))"
}
}) -join [Environment]::NewLine
) |
Select-Object -ExpandProperty Html
$cssReferenceLinks |
ConvertTo-Json -Depth 4 > ./Reference.json
ConvertFrom-Markdown -InputObject @"
To download this list, run:
~~~PowerShell
Invoke-RestMethod https://MrPowerShell.com/CSS/Reference.json
~~~
Or use this [link](https://MrPowerShell.com/CSS/Reference.json)
"@
|
Select-Object -ExpandProperty HTML
if ($PSScriptRoot) { Pop-Location }
- atRules
- attributes
- combinators
- functions
abs()acos()anchor-size()anchor()asin()atan()atan2()attr()blur()brightness()calc-size()calc()circle()clamp()color-mix()color()conic-gradient()contrast-color()contrast()cos()counter()counters()cross-fade()cubic-bezier()device-cmyk()drop-shadow()dynamic-range-limit-mix()element()ellipse()env()exp()fit-content()grayscale()hsl()hue-rotate()hwb()hypot()if()image-set()image()inset()invert()lab()lch()light-dark()linear-gradient()linear()log()matrix()matrix3d()max()min()minmax()mod()oklab()oklch()opacity()paint()path()perspective()polygon()pow()progress()radial-gradient()ray()rect()rem()repeat()repeating-conic-gradient()repeating-linear-gradient()repeating-radial-gradient()rgb()rotate()rotate3d()rotateX()rotateY()rotateZ()round()saturate()scale()scale3d()scaleX()scaleY()scaleZ()sepia()shape()sibling-count()sibling-index()sign()sin()skew()skewX()skewY()sqrt()steps()superellipse()symbols()tan()translate()translate3d()translateX()translateY()translateZ()type()url()var()xywh()
- pseudoClasses
:-moz-broken:-moz-drag-over:-moz-first-node:-moz-handler-blocked:-moz-handler-crashed:-moz-handler-disabled:-moz-last-node:-moz-loading:-moz-locale-dir(ltr):-moz-locale-dir(rtl):-moz-only-whitespace:-moz-submit-invalid:-moz-suppressed:-moz-user-disabled:-moz-window-inactive:active:active-view-transition:any-link:autofill:blank:buffering:checked:current:default:defined:dir():disabled:empty:enabled:first:first-child:first-of-type:focus:focus-visible:focus-within:fullscreen:future:has-slotted:has():heading:heading():host:host-context():host():hover:in-range:indeterminate:invalid:is():lang():last-child:last-of-type:left:link:local-link:modal:muted:not():nth-child():nth-last-child():nth-last-of-type():nth-of-type():only-child:only-of-type:open:optional:out-of-range:past:paused:picture-in-picture:placeholder-shown:playing:popover-open:read-only:read-write:required:right:root:scope:seeking:stalled:state():target:target-current:user-invalid:user-valid:valid:visited:volume-locked:where()
- pseudoElements
::-moz-color-swatch::-moz-focus-inner::-moz-list-bullet::-moz-list-number::-moz-meter-bar::-moz-progress-bar::-moz-range-progress::-moz-range-thumb::-moz-range-track::-webkit-inner-spin-button::-webkit-meter-bar::-webkit-meter-even-less-good-value::-webkit-meter-inner-element::-webkit-meter-optimum-value::-webkit-meter-suboptimum-value::-webkit-progress-bar::-webkit-progress-inner-element::-webkit-progress-value::-webkit-scrollbar::-webkit-search-cancel-button::-webkit-search-results-button::-webkit-slider-runnable-track::-webkit-slider-thumb::after::backdrop::before::checkmark::column::cue::details-content::file-selector-button::first-letter::first-line::grammar-error::highlight()::marker::part()::picker-icon::picker()::placeholder::scroll-button()::scroll-marker::scroll-marker-group::selection::slotted()::spelling-error::target-text::view-transition::view-transition-group()::view-transition-image-pair()::view-transition-new()::view-transition-old()
- selectors
- types
<absolute-size><alpha-value><angle-percentage><angle><baseline-position><basic-shape><blend-mode><box-edge><calc-keyword><calc-sum><color-interpolation-method><color><content-distribution><content-position><corner-shape-value><custom-ident><dashed-function><dashed-ident><dimension><display-box><display-inside><display-internal><display-legacy><display-listitem><display-outside><easing-function><filter-function><flex><frequency-percentage><frequency><generic-family><gradient><hex-color><hue-interpolation-method><hue><ident><image><integer><length-percentage><length><line-style><named-color><number><overflow-position><overflow><percentage><position-area><position><ratio><relative-size><resolution><self-position><shape><string><system-color><text-edge><time-percentage><time><transform-function><url>
To download this list, run:
Invoke-RestMethod https://MrPowerShell.com/CSS/Reference.json
Or use this link