diff --git a/snippets/bouncing-loader.md b/snippets/bouncing-loader.md index 321b9f0dc..067e5bd55 100644 --- a/snippets/bouncing-loader.md +++ b/snippets/bouncing-loader.md @@ -20,10 +20,12 @@ Creates a bouncing loader animation. transform: translate3d(0, -1rem, 0); } } + .bouncing-loader { display: flex; justify-content: center; } + .bouncing-loader > div { width: 1rem; height: 1rem; @@ -32,9 +34,11 @@ Creates a bouncing loader animation. border-radius: 50%; animation: bouncing-loader 0.6s infinite alternate; } + .bouncing-loader > div:nth-child(2) { animation-delay: 0.2s; } + .bouncing-loader > div:nth-child(3) { animation-delay: 0.4s; } diff --git a/snippets/box-sizing-reset.md b/snippets/box-sizing-reset.md index 5be53d0f5..073f28604 100644 --- a/snippets/box-sizing-reset.md +++ b/snippets/box-sizing-reset.md @@ -1,6 +1,6 @@ --- title: Box-sizing reset -tags: layout +tags: layout,beginner --- Resets the box-model so that `width`s and `height`s are not affected by their `border`s or `padding`. @@ -14,11 +14,13 @@ Resets the box-model so that `width`s and `height`s are not affected by their `b html { box-sizing: border-box; } + *, *::before, *::after { box-sizing: inherit; } + .box { display: inline-block; width: 150px; @@ -28,6 +30,7 @@ html { color: white; border: 10px solid red; } + .content-box { box-sizing: content-box; } diff --git a/snippets/button-border-animation.md b/snippets/button-border-animation.md index 830b312b1..4a975d52f 100644 --- a/snippets/button-border-animation.md +++ b/snippets/button-border-animation.md @@ -1,6 +1,6 @@ --- title: Button border animation -tags: animation +tags: animation,intermediate --- Creates a border animation on hover. @@ -18,6 +18,7 @@ Creates a border animation on hover. padding: 12px 40px 10px; position: relative; } + .button:before, .button:after { border: 0 solid transparent; @@ -27,19 +28,23 @@ Creates a border animation on hover. position: absolute; width: 24px; } + .button:before { border-top: 2px solid #c47135; left: 0px; top: -5px; } + .button:after { border-bottom: 2px solid #c47135; bottom: -5px; right: 0px; } + .button:hover { background-color: #c47135; } + .button:hover:before, .button:hover:after { height: 100%; @@ -49,6 +54,6 @@ Creates a border animation on hover. #### Explanation -- Use the `:before` and `:after` pseduo-elements as borders that animate on hover. +- Use the `:before` and `:after` pseudo-elements as borders that animate on hover. #### Browser support diff --git a/snippets/circle.md b/snippets/circle.md index b91d1ab25..2b60e326c 100644 --- a/snippets/circle.md +++ b/snippets/circle.md @@ -1,6 +1,6 @@ --- title: Circle -tags: visual +tags: visual,beginner --- Creates a circle shape with pure CSS. diff --git a/snippets/clearfix.md b/snippets/clearfix.md index 010f9a736..f5f39f667 100644 --- a/snippets/clearfix.md +++ b/snippets/clearfix.md @@ -1,6 +1,6 @@ --- title: Clearfix -tags: layout +tags: layout,beginner --- Ensures that an element self-clears its children. diff --git a/snippets/constant-width-to-height-ratio.md b/snippets/constant-width-to-height-ratio.md index e8007e895..72188c890 100644 --- a/snippets/constant-width-to-height-ratio.md +++ b/snippets/constant-width-to-height-ratio.md @@ -3,8 +3,7 @@ title: Constant width to height ratio tags: layout --- -Given an element of variable width, it will ensure its height remains proportionate in a responsive fashion -(i.e., its width to height ratio remains constant). +Given an element of variable width, it will ensure its height remains proportionate in a responsive fashion (i.e. its width to height ratio remains constant). ```html
@@ -15,11 +14,13 @@ Given an element of variable width, it will ensure its height remains proportion background: #333; width: 50%; } + .constant-width-to-height-ratio::before { content: ''; padding-top: 100%; float: left; } + .constant-width-to-height-ratio::after { content: ''; display: block; diff --git a/snippets/counter.md b/snippets/counter.md index 000e612da..eee6a55cd 100644 --- a/snippets/counter.md +++ b/snippets/counter.md @@ -1,6 +1,6 @@ --- title: Counter -tags: visual, other +tags: visual,advanced --- Counters are, in essence, variables maintained by CSS whose values may be incremented by CSS rules to track how many times they're used. @@ -33,12 +33,12 @@ li::before { #### Explanation -- You can create a ordered list using any type of HTML. +You can create a ordered list using any type of HTML. -1. `counter-reset` Initializes a counter, the value is the name of the counter. By default, the counter starts at 0. This property can also be used to change its value to any specific number. -2. `counter-increment` Used in element that will be countable. Once `counter-reset` initialized, a counter's value can be increased or decreased. -3. `counter(name, style)` Displays the value of a section counter. Generally used in a `content` property. This function can receive two parameters, the first as the name of the counter and the second one can be `decimal` or `upper-roman` (`decimal` by default). -4. `counters(counter, string, style)` Displays the value of a section counter. Generally used in a `content` property. This function can receive three parameters, the first as the name of the counter, the second one you can include a string which comes after the counter and the third one can be `decimal` or `upper-roman` (`decimal` by default). +1. `counter-reset` is used to initialize a counter, the name of which is the value of the attribute. By default, the counter starts at `0`. This property can also be used to change its value to any specific number. +2. `counter-increment` is used for an element that will be countable. Once `counter-reset` is initialized, a counter's value can be increased or decreased. +3. `counter(name, style)` displays the value of a section counter. Generally used with the `content` property. This function can receive two parameters, the first being the name of the counter and the second one either `decimal` or `upper-roman` (`decimal` by default). +4. `counters(counter, string, style)` displays the value of a section counter. Generally used with the `content` property. This function can receive three parameters, the first as the name of the counter, the second one you can include a string which comes after the counter and the third one can be `decimal` or `upper-roman` (`decimal` by default). 5. A CSS counter can be especially useful for making outlined lists, because a new instance of the counter is automatically created in child elements. Using the `counters()` function, separating text can be inserted between different levels of nested counters. #### Browser support diff --git a/snippets/custom-scrollbar.md b/snippets/custom-scrollbar.md index 4c8f0a4ef..dfbce08aa 100644 --- a/snippets/custom-scrollbar.md +++ b/snippets/custom-scrollbar.md @@ -1,6 +1,6 @@ --- title: Custom scrollbar -tags: visual +tags: visual,advanced --- Customizes the scrollbar style for the document and elements with scrollable overflow, on WebKit platforms. diff --git a/snippets/custom-text-selection.md b/snippets/custom-text-selection.md index bcdcd19d6..256aef623 100644 --- a/snippets/custom-text-selection.md +++ b/snippets/custom-text-selection.md @@ -1,6 +1,6 @@ --- title: Custom text selection -tags: visual +tags: visual,beginner --- Changes the styling of text selection. @@ -14,6 +14,7 @@ Changes the styling of text selection. background: aquamarine; color: black; } + .custom-text-selection::selection { background: deeppink; color: white; @@ -26,7 +27,6 @@ Changes the styling of text selection. #### Browser support -⚠️ Requires prefixes for full support and is not actually -in any specification. +⚠️ Requires prefixes for full support and is not actually in any specification. - https://caniuse.com/#feat=css-selection diff --git a/snippets/disable-selection.md b/snippets/disable-selection.md index 81218ee9b..90b2f9c4f 100644 --- a/snippets/disable-selection.md +++ b/snippets/disable-selection.md @@ -1,6 +1,6 @@ --- title: Disable selection -tags: interactivity +tags: interactivity,beginner --- Makes the content unselectable. @@ -20,10 +20,8 @@ Makes the content unselectable. - `user-select: none` specifies that the text cannot be selected. +_Note: This is not a secure method to prevent users from copying content._ + #### Browser support -⚠️ Requires prefixes for full support. -Hover this text to see the effect!
``` @@ -17,6 +15,7 @@ Creates an animated underline effect when the text is hovered over. position: relative; color: #0087ca; } + .hover-underline-animation::after { content: ''; position: absolute; @@ -29,6 +28,7 @@ Creates an animated underline effect when the text is hovered over. transform-origin: bottom right; transition: transform 0.25s ease-out; } + .hover-underline-animation:hover::after { transform: scaleX(1); transform-origin: bottom left; diff --git a/snippets/last-item-with-remaining-available-height.md b/snippets/last-item-with-remaining-available-height.md index eb3060aae..e403eedeb 100644 --- a/snippets/last-item-with-remaining-available-height.md +++ b/snippets/last-item-with-remaining-available-height.md @@ -1,6 +1,6 @@ --- title: Last item with remaining available height -tags: layout +tags: layout,intermediate --- Take advantage of available viewport space by giving the last element the remaining available space in current viewport, even when resizing the window. @@ -34,15 +34,13 @@ body { #### Explanation -1. `height: 100%` set the height of container as viewport height. -2. `display: flex` enables flexbox. +1. `height: 100%` sets the height of container as viewport height. +2. `display: flex` creates a flexbox layout. 3. `flex-direction: column` set the direction of flex items' order from top to down. 4. `flex-grow: 1` the flexbox will apply remaining available space of container to last child element. -- The parent must have a viewport height. `flex-grow: 1` could be applied to the first or second element, which will have all available space. +- The parent must have a viewport height. `flex-grow: 1` could be applied to the first or second element, which will occupy all available space. #### Browser support -⚠️ Needs prefixes for full support. - - https://caniuse.com/#feat=flexbox diff --git a/snippets/lobotomizedOwlSelector.md b/snippets/lobotomizedOwlSelector.md index 4e557ae97..dde6b4e8c 100644 --- a/snippets/lobotomizedOwlSelector.md +++ b/snippets/lobotomizedOwlSelector.md @@ -1,6 +1,6 @@ --- title: Lobotomized Owl Selector -tags: layout, beginner +tags: layout,beginner --- Sets an automatically inherited margin for all elements that follow other elements in the document. @@ -24,8 +24,8 @@ Sets an automatically inherited margin for all elements that follow other elemen #### Explanation -- [View this link for a detailed explanation.](https://alistapart.com/article/axiomatic-css-and-lobotomized-owls/) - In this example, all elements in the flow of the document that follow other elements will receive `margin-top: 1.5em`. - This example assumes that the paragraphs' `font-size` is 1em and its `line-height` is 1.5. +_Note: You can read [this article](https://alistapart.com/article/axiomatic-css-and-lobotomized-owls/_) for a more detailed explanation._ #### Browser support diff --git a/snippets/masonry-layout.md b/snippets/masonry-layout.md index cd7fa9c8c..3e29a1230 100644 --- a/snippets/masonry-layout.md +++ b/snippets/masonry-layout.md @@ -3,7 +3,7 @@ title: Masonry Layout tags: layout,advanced --- -Creates a vertical Masonry layout using pure HTML and CSS. +Creates a vertical masonry layout using HTML and CSS. ```html