CSS code examples
11 short, tested snippets. Pick one to see the code with notes, or search Zest for something specific, such as “css center a div”.
- Center a div/* flexbox */
- Flexbox layout.row {
- Responsive grid columns.grid {
- Media query@media (max-width: 640px) {
- CSS variables:root {
- Truncate text with an ellipsis/* one line */
- Sticky headerheader {
- Hover transition.button {
- Keyframe animation@keyframes spin { to { transform: rotate(360deg); } }
- Aspect ratio.video { aspect-ratio: 16 / 9; width: 100%; }
- Absolute centering.modal {