公式サイト:CSS Snapshot 2020 - W3C#5.3. At-Rule Index
公式サイト:CSS Indexes - W3C#6. At-Rules
参考:How CSS is structured - Learn web development - MDN#@rules
目次
1. @font-face - フォントに関する@ルール
公式サイト:CSS Fonts Module Level 4 - W3C
公式サイト:CSS Fonts Module Level 5 - W3C
@font-face {font-family: "Open Sans";src: url("/fonts/OpenSans-Regular-webfont.woff2") format("woff2"),url("/fonts/OpenSans-Regular-webfont.woff") format("woff");}
説明。説明。説明。説明。説明。説明。説明。説明。説明。説明。説明。説明。説明。説明。説明。説明。説明。説明。説明。説明。説明。説明。説明。説明。説明。説明。説明。説明。説明。説明。説明。説明。説明。説明。
@media
公式サイト:Media Queries - W3C
公式サイト:Media Queries Level 4 - W3C
公式サイト:Media Queries Level 5 - W3C
/* At the top level of your code */
@media screen and (min-width: 900px) {
article {
padding: 1rem 3rem;
}
}
/* Nested within another conditional at-rule */
@supports (display: flex) {
@media screen and (min-width: 900px) {
article {
display: flex;
}
}
}
Media Queries @viewport min-width max-width width min-height max-height height zoom min-zoom max-zoom user-zoom orientation extends-to-zoom
@supports
公式サイト:CSS Conditional Rules Module Level 3 - W3C
公式サイト:CSS Conditional Rules Module Level 4 - W3C
@supports (display: grid) {
div {
display: grid;
}
}
@supports not (display: grid) {
div {
float: right;
}
}
@charset
公式サイト:Cascading Style Sheets Level 2 Revision 2 (CSS 2.2) Specification - W3C#4.4 CSS style sheet representation
参考:@charset - CSS: Cascading Style Sheets | MDN
@charset "utf-8";
@charset shape-inside border-boundary
@keyframes
@keyframes slidein {
from {
transform: translateX(0%);
}
to {
transform: translateX(100%);
}
}
2. KnotTextでのCSSの分類
2-1. CSSセレクター
2-1-1. ベーシックセレクター
| ユニバーサルセレクタ― | * { } |
|---|---|
| タイプセレクタ― | element { } |
| クラスセレクタ― | .classname { } |
| IDセレクター | #idname { } |
| 属性セレクタ― | selector[attribute] { } |
| セレクターリスト | div, p { } |
|---|
2-1-3. コンビネーター(結合子)
| 子孫結合子 | div a |
|---|---|
| 子結合子 | div > a |
| 一般兄弟結合子 | p ~ a |
| 隣接兄弟結合子 | p + a |
2-1-4. 疑似クラスと疑似要素
| 疑似クラス | div:hover { } |
|---|---|
| 疑似要素 | div::before { } |
2-2. CSSプロパティ
| 3D | perspective, backface-visibilityなど | |
|---|---|---|
| animation | animation, transform, transitionなど | |
| boxmodel | outline, margin, border, padding, background, overflow, z-index, height, width, positionなど | |
| counter | counter-increment, counter-reset, counter-setなど | |
| custom | --* | |
| element | box-shadow, box-sizing, object-fit, object-position, opacity, mix-blend-mode, visibility, content, display, text-overflow, float, clear, empty-cells, caption-side, list-styleなど | |
| graphics | backdrop-filter, filter, shape-image-threashold, shape-margin, scale, image-rendering, aspect-ratio, mask, clip, clip-path, inset, outsetなど | |
| internationalization | line-break, writing-mode, text-orientation, text-combine-upright, direction, unicode-bidi, block-size, inline-sizeなど | |
| layout | column-rule, flex, grid, align-content, align-items, align-self, align-tracks, justify-content, justify-items, justify-self, order, column-count, column-fill, column-gap, columns, column-span, column-width, gap, row-gap, place-content, place-items, place-self, vertical-alignなど | |
| performance | forced-color-adjust, text-rendering, content-visibility, will-change, color-scheme, contain, color-adjustなど | |
| text | word-spacing, text-shadow, text-transform, text-underline-offset, text-underline-position, white-space, shape-outside, text-align, text-align-last, text-indent, text-justify, letter-spacing, line-height, line-height-step, widows, word-break, word-wrap, color, hanging-punctuation, hyphens, initial-letter, orphans, quotes, font, text-decoration, text-emphasis, break-after, break-before, break-insideなど | |
| user-interface | scroll-margin, scroll-padding, overscroll-behavior, user-select, touch-action, caret-color, cursor, resize, pointer-events, scrollbar-color, scrollbar-gutter, scrollbar-width, scroll-behavior, scroll-snap-align, scroll-snap-typeなど | |
| その他のCSSプロパティ | ||
2-3. CSSプロパティの値
| Length | px pt vh... |
|---|---|
| inherit, unset... | |
| !important | |
| Functions | attr(), calc(), clamp(), max(), min()... |
| Angle | deg, grad, rad, turn... |
| Resolution | dpi, dpcm, dppx, x... |
| Time | s, ms... |
| Frequency | Hz, kHz... |
| その他の値 | |
2-4. @ルール
| @font-face | Webフォント |
|---|---|
| @namespace | |
| @media | @media(min-width: 540px) { } |
| @supports | |
| @charset | @charset 'utf-8'; |
| @page | |
| @counter-style | |
| @color-profile | |
| @keyframes | |
| その他の@ルール | |
W3C CSS Validation Service は CSS が正しく書かれているかを判定するために利用できます。デバッグのために重宝するツールです。