From de4b0dae00a49c66cab6469f6da2459ce0937ba8 Mon Sep 17 00:00:00 2001 From: 30secondsofcode <30secondsofcode@gmail.com> Date: Sun, 16 Dec 2018 21:07:42 +0000 Subject: [PATCH] Travis build: 97 [cron] --- docs/index.html | 78 +++++++++++++++--------------------- index.html | 102 ++++++++++++++++++------------------------------ 2 files changed, 70 insertions(+), 110 deletions(-) diff --git a/docs/index.html b/docs/index.html index d9c8bff78..8485039c3 100644 --- a/docs/index.html +++ b/docs/index.html @@ -111,9 +111,9 @@ li::before { }
You can create a ordered list using any type of HTML.
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.
counter-increment Used in element that will be countable. Once counter-reset initialized, a counter's value can be increased or decreased.
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).
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).
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.
✅ No caveats.
Customizes the scrollbar style for the document and elements with scrollable overflow, on WebKit platforms.
<div class="custom-scrollbar">
<p>
- Lorem ipsum dolor sit amet consectetur adipisicing elit.<br>
- Iure id exercitationem nulla qui repellat laborum vitae, <br>
- molestias tempora velit natus. Quas, assumenda nisi. <br>
+ Lorem ipsum dolor sit amet consectetur adipisicing elit.<br />
+ Iure id exercitationem nulla qui repellat laborum vitae, <br />
+ molestias tempora velit natus. Quas, assumenda nisi. <br />
Quisquam enim qui iure, consequatur velit sit?
</p>
</div>
@@ -162,9 +162,7 @@ li::before {
user-select: none;
}
You can select me.
You can't select me!
user-select: none specifies that the text cannot be selected.
⚠️ Requires prefixes for full support. ⚠️ This is not a secure method to prevent users from copying content.
Vertically and horizontally centers a child element within its parent element using display: table (as an alternative to flexbox).
<div class="container">
- <div class="center">
- <span>Centered content</span>
- </div>
+ <div class="center"><span>Centered content</span></div>
</div>
.container {
border: 1px solid #333;
@@ -181,7 +179,7 @@ li::before {
text-align: center;
vertical-align: middle;
}
- display: table on '.center' allows the element to behave like a <table> HTML element.display: table-cell on '.center > span' allows the element to behave like an HTML element.text-align: center on '.center > span' centers the child element horizontally.vertical-align: middle on '.center > span' centers the child element vertically.The outer parent ('.container' in this case) must have a fixed height and width.
✅ No caveats.
Creates a donut spinner that can be used to indicate the loading of content.
<div class="donut"></div>
+ display: table on '.center' allows the element to behave like a <table> HTML element.display: table-cell on '.center > span' allows the element to behave like an HTML element.text-align: center on '.center > span' centers the child element horizontally.vertical-align: middle on '.center > span' centers the child element vertically.The outer parent ('.container' in this case) must have a fixed height and width.
✅ No caveats.
Creates a donut spinner that can be used to indicate the loading of content.
<div class="donut"></div>
@keyframes donut-spin {
0% {
transform: rotate(0deg);
@@ -270,8 +268,8 @@ li::before {
display: flex;
justify-content: space-between;
}
- Item1
Item2
Item3
display: flex enables flexbox.justify-content: space-between evenly distributes child elements horizontally. The first item is positioned at the left edge, while the last item is positioned at the right edge.Alternatively, use justify-content: space-around to distribute the children with space around them, rather than between them.
⚠️ Needs prefixes for full support.
Changes the fit and position of an image within its container while preserving its aspect ratio. Previously only possible using a background image and the background-size property.
<img class="image image-contain" src="https://picsum.photos/600/200">
-<img class="image image-cover" src="https://picsum.photos/600/200">
+ Item1
Item2
Item3
display: flex enables flexbox.justify-content: space-between evenly distributes child elements horizontally. The first item is positioned at the left edge, while the last item is positioned at the right edge.Alternatively, use justify-content: space-around to distribute the children with space around them, rather than between them.
⚠️ Needs prefixes for full support.
Changes the fit and position of an image within its container while preserving its aspect ratio. Previously only possible using a background image and the background-size property.
<img class="image image-contain" src="https://picsum.photos/600/200" />
+<img class="image image-cover" src="https://picsum.photos/600/200" />
.image {
background: #34495e;
border: 1px solid #34495e;
@@ -286,9 +284,7 @@ li::before {
object-fit: cover;
object-position: right top;
}
- object-fit: contain fits the entire image within the container while preserving its aspect ratio.object-fit: cover fills the container with the image while preserving its aspect ratio.object-position: [x] [y] positions the image within the container.✅ No caveats.
Horizontally and vertically centers a child element within a parent element using flexbox.
<div class="flexbox-centering">
- <div class="child">Centered content.</div>
-</div>
+ object-fit: contain fits the entire image within the container while preserving its aspect ratio.object-fit: cover fills the container with the image while preserving its aspect ratio.object-position: [x] [y] positions the image within the container.✅ No caveats.
Horizontally and vertically centers a child element within a parent element using flexbox.
<div class="flexbox-centering"><div class="child">Centered content.</div></div>
.flexbox-centering {
display: flex;
justify-content: center;
@@ -301,9 +297,7 @@ li::before {
-webkit-text-fill-color: transparent;
-webkit-background-clip: text;
}
- Gradient text
background: -webkit-linear-gradient(...) gives the text element a gradient background.webkit-text-fill-color: transparent fills the text with a transparent color.webkit-background-clip: text clips the background with the text, filling the text with the gradient background as the color.⚠️ Uses non-standard properties.
Horizontally and vertically centers a child element within a parent element using grid.
<div class="grid-centering">
- <div class="child">Centered content.</div>
-</div>
+ Gradient text
background: -webkit-linear-gradient(...) gives the text element a gradient background.webkit-text-fill-color: transparent fills the text with a transparent color.webkit-background-clip: text clips the background with the text, filling the text with the gradient background as the color.⚠️ Uses non-standard properties.
Horizontally and vertically centers a child element within a parent element using grid.
<div class="grid-centering"><div class="child">Centered content.</div></div>
.grid-centering {
display: grid;
justify-content: center;
@@ -385,9 +379,7 @@ body {
background-color: tomato;
flex: 1;
}
- height: 100% set the height of container as viewport height.display: flex enables flexbox.flex-direction: column set the direction of flex items' order from top to down.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.
⚠️ Needs prefixes for full support.
A hover effect where the gradient follows the mouse cursor.
Credit: Tobias Reich
<button class="mouse-cursor-gradient-tracking">
- <span>Hover me</span>
-</button>
+ height: 100% set the height of container as viewport height.display: flex enables flexbox.flex-direction: column set the direction of flex items' order from top to down.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.
⚠️ Needs prefixes for full support.
A hover effect where the gradient follows the mouse cursor.
Credit: Tobias Reich
<button class="mouse-cursor-gradient-tracking"><span>Hover me</span></button>
.mouse-cursor-gradient-tracking {
position: relative;
background: #7983ff;
@@ -424,7 +416,7 @@ btn.onmousemove = function(e) {
btn.style.setProperty('--x', x + 'px')
btn.style.setProperty('--y', y + 'px')
}
- TODO
The :not psuedo selector is useful for styling a group of elements, while leaving the last (or specified) element unstyled.
<ul class="css-not-selector-shortcut">
+ TODO
The :not psuedo selector is useful for styling a group of elements, while leaving the last (or specified) element unstyled.
<ul class="css-not-selector-shortcut">
<li>One</li>
<li>Two</li>
<li>Three</li>
@@ -445,8 +437,7 @@ li:not(:last-child) {
border-right: 2px solid #d2d5e4;
}
li:not(:last-child) specifies that the styles should apply to all li elements except the :last-child.
✅ No caveats.
A bulletproof way to completely hide an element visually and positionally in the DOM while still allowing it to be accessed by JavaScript and readable by screen readers. This method is very useful for accessibility (ADA) development when more context is needed for visually-impaired users. As an alternative to display: none which is not readable by screen readers or visibility: hidden which takes up physical space in the DOM.
<a class="button" href="http://pantswebsite.com">
- Learn More
- <span class="offscreen"> about pants</span>
+ Learn More <span class="offscreen"> about pants</span>
</a>
.offscreen {
border: 0;
@@ -460,13 +451,13 @@ li:not(:last-child) {
}
clip to indicate that no part of the element should be shown.margin: -1px.✅ No caveats.
(Although clip technically has been depreciated, the newer clip-path currently has very limited browser support.)
Adds a fading gradient to an overflowing element to better indicate there is more content to be scrolled.
<div class="overflow-scroll-gradient">
<div class="overflow-scroll-gradient__scroller">
- Lorem ipsum dolor sit amet consectetur adipisicing elit. <br>
- Iure id exercitationem nulla qui repellat laborum vitae, <br>
- molestias tempora velit natus. Quas, assumenda nisi. <br>
- Quisquam enim qui iure, consequatur velit sit? <br>
- Lorem ipsum dolor sit amet consectetur adipisicing elit.<br>
- Iure id exercitationem nulla qui repellat laborum vitae, <br>
- molestias tempora velit natus. Quas, assumenda nisi. <br>
+ Lorem ipsum dolor sit amet consectetur adipisicing elit. <br />
+ Iure id exercitationem nulla qui repellat laborum vitae, <br />
+ molestias tempora velit natus. Quas, assumenda nisi. <br />
+ Quisquam enim qui iure, consequatur velit sit? <br />
+ Lorem ipsum dolor sit amet consectetur adipisicing elit.<br />
+ Iure id exercitationem nulla qui repellat laborum vitae, <br />
+ molestias tempora velit natus. Quas, assumenda nisi. <br />
Quisquam enim qui iure, consequatur velit sit?
</div>
</div>
@@ -493,11 +484,7 @@ li:not(:last-child) {
padding: 15px;
line-height: 1.2;
}
- position: relative on the parent establishes a Cartesian positioning context for pseudo-elements.::after defines a pseudo element.background-image: linear-gradient(...) adds a linear gradient that fades from transparent to white (top to bottom).position: absolute takes the pseudo element out of the flow of the document and positions it in relation to the parent.width: 240px matches the size of the scrolling element (which is a child of the parent that has the pseudo element).height: 25px is the height of the fading gradient pseudo-element, which should be kept relatively small.bottom: 0 positions the pseudo-element at the bottom of the parent.pointer-events: none specifies that the pseudo-element cannot be a target of mouse events, allowing text behind it to still be selectable/interactive.✅ No caveats.
Reveals an interactive popout menu on hover and focus.
<div class="reference" tabindex="0">
- <div class="popout-menu">
- Popout menu
- </div>
-</div>
+ position: relative on the parent establishes a Cartesian positioning context for pseudo-elements.::after defines a pseudo element.background-image: linear-gradient(...) adds a linear gradient that fades from transparent to white (top to bottom).position: absolute takes the pseudo element out of the flow of the document and positions it in relation to the parent.width: 240px matches the size of the scrolling element (which is a child of the parent that has the pseudo element).height: 25px is the height of the fading gradient pseudo-element, which should be kept relatively small.bottom: 0 positions the pseudo-element at the bottom of the parent.pointer-events: none specifies that the pseudo-element cannot be a target of mouse events, allowing text behind it to still be selectable/interactive.✅ No caveats.
Reveals an interactive popout menu on hover and focus.
<div class="reference" tabindex="0"><div class="popout-menu">Popout menu</div></div>
.reference {
position: relative;
background: tomato;
@@ -517,7 +504,7 @@ li:not(:last-child) {
.reference:focus-within > .popout-menu {
visibility: visible;
}
- position: relative on the reference parent establishes a Cartesian positioning context for its child.position: absolute takes the popout menu out of the flow of the document and positions it in relation to the parent.left: 100% moves the the popout menu 100% of its parent's width from the left.visibility: hidden hides the popout menu initially and allows for transitions (unlike display: none)..reference:hover > .popout-menu means that when .reference is hovered over, select immediate children with a class of .popout-menu and change their visibility to visible, which shows the popout..reference:focus > .popout-menu means that when .reference is focused, the popout would be shown..reference:focus-within > .popout-menu ensures that the popout is shown when the focus is within the reference.✅ No caveats.
A nicer alternative to text-decoration: underline or <u></u> where descenders do not clip the underline. Natively implemented as text-decoration-skip-ink: auto but it has less control over the underline.
<p class="pretty-text-underline">Pretty text underline without clipping descending letters.</p>
+ position: relative on the reference parent establishes a Cartesian positioning context for its child.position: absolute takes the popout menu out of the flow of the document and positions it in relation to the parent.left: 100% moves the the popout menu 100% of its parent's width from the left.visibility: hidden hides the popout menu initially and allows for transitions (unlike display: none)..reference:hover > .popout-menu means that when .reference is hovered over, select immediate children with a class of .popout-menu and change their visibility to visible, which shows the popout..reference:focus > .popout-menu means that when .reference is focused, the popout would be shown..reference:focus-within > .popout-menu ensures that the popout is shown when the focus is within the reference.✅ No caveats.
A nicer alternative to text-decoration: underline or <u></u> where descenders do not clip the underline. Natively implemented as text-decoration-skip-ink: auto but it has less control over the underline.
<p class="pretty-text-underline">Pretty text underline without clipping descending letters.</p>
.pretty-text-underline {
display: inline;
text-shadow: 1px 1px #f5f6f9, -1px 1px #f5f6f9, -1px -1px #f5f6f9, 1px -1px #f5f6f9;
@@ -536,12 +523,16 @@ li:not(:last-child) {
}
Pretty text underline without clipping descending letters.
text-shadow uses 4 values with offsets that cover a 4x4 px area to ensure the underline has a "thick" shadow that covers the line where descenders clip it. Use a color that matches the background. For a larger font, use a larger px size. Additional values can create an even thicker shadow, and subpixel values can also be used.background-image: linear-gradient(...) creates a 90deg gradient using the text color (currentColor).background-* properties size the gradient as 100% of the width of the block and 1px in height at the bottom and disables repetition, which creates a 1px underline beneath the text.::selection pseudo selector rule ensures the text shadow does not interfere with text selection.✅ No caveats.
Resets all styles to default values with one property. This will not affect direction and unicode-bidi properties.
<div class="reset-all-styles">
<h5>Title</h5>
- <p>Lorem ipsum dolor sit amet consectetur adipisicing elit. Iure id exercitationem nulla qui repellat laborum vitae, molestias tempora velit natus. Quas, assumenda nisi. Quisquam enim qui iure, consequatur velit sit?</p>
+ <p>
+ Lorem ipsum dolor sit amet consectetur adipisicing elit. Iure id exercitationem nulla qui
+ repellat laborum vitae, molestias tempora velit natus. Quas, assumenda nisi. Quisquam enim qui
+ iure, consequatur velit sit?
+ </p>
</div>
.reset-all-styles {
all: initial;
}
- Lorem ipsum dolor sit amet consectetur adipisicing elit. Iure id exercitationem nulla qui repellat laborum vitae, molestias tempora velit natus. Quas, assumenda nisi. Quisquam enim qui iure, consequatur velit sit?
The all property allows you to reset all styles (inherited or not) to default values.
⚠️ MS Edge status is under consideration.
Uses an SVG shape to separate two different blocks to create more a interesting visual appearance compared to standard horizontal separation.
<div class="shape-separator"></div>
+ Lorem ipsum dolor sit amet consectetur adipisicing elit. Iure id exercitationem nulla qui repellat laborum vitae, molestias tempora velit natus. Quas, assumenda nisi. Quisquam enim qui iure, consequatur velit sit?
The all property allows you to reset all styles (inherited or not) to default values.
⚠️ MS Edge status is under consideration.
Uses an SVG shape to separate two different blocks to create more a interesting visual appearance compared to standard horizontal separation.
<div class="shape-separator"></div>
.shape-separator {
position: relative;
height: 48px;
@@ -556,12 +547,8 @@ li:not(:last-child) {
bottom: 0;
}
position: relative on the element establishes a Cartesian positioning context for pseudo elements.::after defines a pseudo element.background-image: url(...) adds the SVG shape (a 24x12 triangle) as the background image of the pseudo element, which repeats by default. It must be the same color as the block that is being separated. For other shapes, we can use the URL-encoder for SVG.position: absolute takes the pseudo element out of the flow of the document and positions it in relation to the parent.width: 100% ensures the element stretches the entire width of its parent.height: 12px is the same height as the shape.bottom: 0 positions the pseudo element at the bottom of the parent.✅ No caveats.
Fades out the siblings of a hovered item.
<div class="sibling-fade">
- <span>Item 1</span>
- <span>Item 2</span>
- <span>Item 3</span>
- <span>Item 4</span>
- <span>Item 5</span>
- <span>Item 6</span>
+ <span>Item 1</span> <span>Item 2</span> <span>Item 3</span> <span>Item 4</span>
+ <span>Item 5</span> <span>Item 6</span>
</div>
span {
padding: 0 1rem;
@@ -575,8 +562,7 @@ li:not(:last-child) {
font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen-Sans, Ubuntu,
Cantarell, 'Helvetica Neue', Helvetica, Arial, sans-serif;
}
- This text uses the system font.
The browser looks for each successive font, preferring the first one if possible, and falls back to the next if it cannot find the font (on the system or defined in CSS).
-apple-system is San Francisco, used on iOS and macOS (not Chrome however)BlinkMacSystemFont is San Francisco, used on macOS ChromeSegoe UI is used on Windows 10Roboto is used on AndroidOxygen-Sans is used on GNU+LinuxUbuntu is used on Linux"Helvetica Neue" and Helvetica is used on macOS 10.10 and below (wrapped in quotes because it has a space)Arial is a font widely supported by all operating systemssans-serif is the fallback sans-serif font if none of the other fonts are supported✅ No caveats.
Creates a toggle switch with CSS only.
<input type="checkbox" id="toggle" class="offscreen" />
-<label for="toggle" class="switch"></label>
+ This text uses the system font.
The browser looks for each successive font, preferring the first one if possible, and falls back to the next if it cannot find the font (on the system or defined in CSS).
-apple-system is San Francisco, used on iOS and macOS (not Chrome however)BlinkMacSystemFont is San Francisco, used on macOS ChromeSegoe UI is used on Windows 10Roboto is used on AndroidOxygen-Sans is used on GNU+LinuxUbuntu is used on Linux"Helvetica Neue" and Helvetica is used on macOS 10.10 and below (wrapped in quotes because it has a space)Arial is a font widely supported by all operating systemssans-serif is the fallback sans-serif font if none of the other fonts are supported✅ No caveats.
Creates a toggle switch with CSS only.
<input type="checkbox" id="toggle" class="offscreen" /> <label for="toggle" class="switch"></label>
.switch {
position: relative;
display: inline-block;
@@ -607,9 +593,7 @@ input[type='checkbox']:checked + .switch {
position: absolute;
left: -9999px;
}
- This effect is styling only the <label> element to look like a toggle switch, and hiding the actual <input> checkbox by positioning it offscreen. When clicking the label associated with the <input> element, it sets the <input> checkbox into the :checked state.
for attribute associates the <label> with the appropriate <input> checkbox element by its id..switch::after defines a pseudo-element for the <label> to create the circular knob.input[type='checkbox']:checked + .switch::after targets the <label>'s pseudo-element's style when the checkbox is checked.transform: translateX(20px) moves the pseudo-element (knob) 20px to the right when the checkbox is checked.background-color: #7983ff; sets the background-color of the switch to a different color when the checkbox is checked..offscreen moves the <input> checkbox element, which does not comprise any part of the actual toggle switch, out of the flow of document and positions it far away from the view, but does not hide it so it is accessible via keyboard and screen readers.transition: all 0.3s specifies all property changes will be transitioned over 0.3 seconds, therefore transitioning the <label>'s background-color and the pseudo-element's transform property when the checkbox is checked.⚠️ Requires prefixes for full support.
Vertically and horizontally centers a child element within its parent element using position: absolute and transform: translate() (as an alternative to flexbox or display: table). Similar to flexbox, this method does not require you to know the height or width of your parent or child so it is ideal for responsive applications.
<div class="parent">
- <div class="child">Centered content</div>
-</div>
+ This effect is styling only the <label> element to look like a toggle switch, and hiding the actual <input> checkbox by positioning it offscreen. When clicking the label associated with the <input> element, it sets the <input> checkbox into the :checked state.
for attribute associates the <label> with the appropriate <input> checkbox element by its id..switch::after defines a pseudo-element for the <label> to create the circular knob.input[type='checkbox']:checked + .switch::after targets the <label>'s pseudo-element's style when the checkbox is checked.transform: translateX(20px) moves the pseudo-element (knob) 20px to the right when the checkbox is checked.background-color: #7983ff; sets the background-color of the switch to a different color when the checkbox is checked..offscreen moves the <input> checkbox element, which does not comprise any part of the actual toggle switch, out of the flow of document and positions it far away from the view, but does not hide it so it is accessible via keyboard and screen readers.transition: all 0.3s specifies all property changes will be transitioned over 0.3 seconds, therefore transitioning the <label>'s background-color and the pseudo-element's transform property when the checkbox is checked.⚠️ Requires prefixes for full support.
Vertically and horizontally centers a child element within its parent element using position: absolute and transform: translate() (as an alternative to flexbox or display: table). Similar to flexbox, this method does not require you to know the height or width of your parent or child so it is ideal for responsive applications.
<div class="parent"><div class="child">Centered content</div></div>
.parent {
border: 1px solid #333;
height: 250px;
diff --git a/index.html b/index.html
index 7b8cb2766..217657e75 100644
--- a/index.html
+++ b/index.html
@@ -519,9 +519,9 @@ li::before {
Customizes the scrollbar style for the document and elements with scrollable overflow, on WebKit platforms.
HTML
<div class="custom-scrollbar">
<p>
- Lorem ipsum dolor sit amet consectetur adipisicing elit.<br>
- Iure id exercitationem nulla qui repellat laborum vitae, <br>
- molestias tempora velit natus. Quas, assumenda nisi. <br>
+ Lorem ipsum dolor sit amet consectetur adipisicing elit.<br />
+ Iure id exercitationem nulla qui repellat laborum vitae, <br />
+ molestias tempora velit natus. Quas, assumenda nisi. <br />
Quisquam enim qui iure, consequatur velit sit?
</p>
</div>
@@ -719,9 +719,7 @@ in any specification.
Display table centering
Vertically and horizontally centers a child element within its parent element using display: table (as an alternative to flexbox).
HTML
<div class="container">
- <div class="center">
- <span>Centered content</span>
- </div>
+ <div class="center"><span>Centered content</span></div>
</div>
CSS
.container {
@@ -743,9 +741,7 @@ in any specification.
Demo
-
- Centered content
-
+ Centered content