This file contains 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
/** | |
* Animation along a circular path - Solution 2 | |
*/ | |
@keyframes spin { | |
from { | |
transform: rotate(0turn) | |
translateY(-150px) translateY(50%) | |
rotate(1turn) | |
} |
This file contains 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
/** | |
* Styling by sibling count: Color palette example | |
*/ | |
/* Hide "color" 4 items or more */ | |
.palette li:first-child:nth-last-child(n+4) .color-options a:after, | |
.palette li:first-child:nth-last-child(n+4) ~ li .color-options a:after { | |
content: none; | |
} |
This file contains 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
/** | |
* Fluid background, fixed content | |
*/ | |
header, section, footer { | |
padding: 1em calc(50% - 350px); | |
} | |
footer { | |
background: #333; |
This file contains 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
/** | |
* Vertical centering - absolute positioning method | |
*/ | |
main { | |
position: absolute; | |
top: 50%; | |
left: 50%; | |
transform: translate(-50%, -50%); | |
This file contains 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
/** | |
* Vertical centering - Viewport unit method | |
*/ | |
main { | |
width: 18em; | |
padding: 1em 1.5em; | |
margin: 50vh auto 0; | |
transform: translateY(-50%); | |
box-sizing: border-box; |
This file contains 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
/** | |
* Vertical centering - Flexbox solution | |
*/ | |
* { margin: 0 } | |
body { | |
display: flex; | |
min-height: 100vh; | |
} |
This file contains 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
/** | |
* Vertical centering - Flexbox solution for text | |
*/ | |
body { | |
display: flex; | |
align-items: center; | |
min-height: 100%; | |
margin: 0; | |
} |
This file contains 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
/** | |
* Sticky footer with fixed height | |
*/ | |
main { | |
min-height: calc(100vh - 5em - 7em); | |
} | |
/* Toggle checkbox to alternate between short/long content */ | |
#contents:checked ~ p { display: none } |
This file contains 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
/** | |
* Sticky footer with flexible height | |
*/ | |
body { | |
display: flex; | |
flex-direction: column; | |
min-height: 100vh; | |
} |
This file contains 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
/** | |
* Intrinsic sizing | |
*/ | |
figure { | |
max-width: 300px; | |
max-width: min-content; | |
margin: auto; | |
} |