1) Modern CSS Reset (minimal)<\/h2>\n\n\n\n*,\n*::before,\n*::after { box-sizing: border-box; }\n\nhtml, body { height: 100%; }\n\nbody { margin: 0; line-height: 1.5; -webkit-font-smoothing: antialiased; }\n\nimg, picture, video, canvas, svg { display: block; max-width: 100%; }\n\ninput, button, textarea, select { font: inherit; }\n<\/code><\/pre>\n\n\n\nDoes:<\/strong> Prevents common layout surprises (box sizing, default margins, media sizing).
Use it:<\/strong> Put at the top of your stylesheet for consistent baseline behavior.<\/p>\n\n\n\n
\n\n\n\n2) Fluid Container<\/h2>\n\n\n\n.container { width: min(1100px, 92%); margin-inline: auto; }\n<\/code><\/pre>\n\n\n\nDoes:<\/strong> Keeps content readable on large screens and padded on small screens.
Use it:<\/strong> Wrap page sections in .container<\/code>.<\/p>\n\n\n\n
\n\n\n\n3) Responsive Typography (clamp)<\/h2>\n\n\n\nh1 { font-size: clamp(1.8rem, 3vw + 1rem, 3.2rem); }\n<\/code><\/pre>\n\n\n\nDoes:<\/strong> Automatically scales font size between min and max based on viewport.
Use it:<\/strong> Great for headings on responsive pages.<\/p>\n\n\n\n
\n\n\n\n4) Better Line Length<\/h2>\n\n\n\n.prose { max-width: 65ch; }\n<\/code><\/pre>\n\n\n\nDoes:<\/strong> Limits text width to a comfortable reading length.
Use it:<\/strong> Apply to blog\/article text containers.<\/p>\n\n\n\n
\n\n\n\n5) Center Anything (Grid)<\/h2>\n\n\n\n.center { display: grid; place-items: center; }\n<\/code><\/pre>\n\n\n\nDoes:<\/strong> Perfect vertical + horizontal centering.
Use it:<\/strong> For modals, empty states, hero sections.<\/p>\n\n\n\n
\n\n\n\n6) Sticky Header<\/h2>\n\n\n\n.header {\n position: sticky;\n top: 0;\n z-index: 10;\n background: white;\n}\n<\/code><\/pre>\n\n\n\nDoes:<\/strong> Keeps header visible while scrolling.
Use it:<\/strong> Add to nav bars; ensure background isn\u2019t transparent.<\/p>\n\n\n\n
\n\n\n\n7) Smooth Scrolling<\/h2>\n\n\n\nhtml { scroll-behavior: smooth; }\n<\/code><\/pre>\n\n\n\nDoes:<\/strong> Smoothly scrolls to anchor links.
Use it:<\/strong> Great for one-page sites with section links.<\/p>\n\n\n\n
\n\n\n\n8) Scroll Margin for Anchors (fix sticky header overlap)<\/h2>\n\n\n\nsection { scroll-margin-top: 80px; }\n<\/code><\/pre>\n\n\n\nDoes:<\/strong> Adds space when jumping to anchors so content isn\u2019t hidden behind sticky header.
Use it:<\/strong> Set to your header height.<\/p>\n\n\n\n
\n\n\n\n9) Nice Focus Ring (accessible)<\/h2>\n\n\n\n:focus-visible {\n outline: 3px solid #3b82f6;\n outline-offset: 3px;\n}\n<\/code><\/pre>\n\n\n\nDoes:<\/strong> Shows focus only for keyboard users (better UX).
Use it:<\/strong> Improves accessibility on forms\/buttons\/links.<\/p>\n\n\n\n
\n\n\n\n10) Hide Visually, Keep for Screen Readers<\/h2>\n\n\n\n.sr-only {\n position: absolute; width: 1px; height: 1px;\n padding: 0; margin: -1px; overflow: hidden;\n clip: rect(0,0,0,0); white-space: nowrap; border: 0;\n}\n<\/code><\/pre>\n\n\n\nDoes:<\/strong> Hides text visually while keeping it accessible.
Use it:<\/strong> Labels, helper text, \u201cSkip to content\u201d.<\/p>\n\n\n\n
\n\n\n\nLayout & Positioning<\/h1>\n\n\n\n11) Flex Row with Gap<\/h2>\n\n\n\n.row { display: flex; gap: 1rem; align-items: center; }\n<\/code><\/pre>\n\n\n\nDoes:<\/strong> Row layout with consistent spacing.
Use it:<\/strong> Toolbars, nav items, button groups.<\/p>\n\n\n\n12) Wrap Items Responsively<\/h2>\n\n\n\n.wrap { display: flex; flex-wrap: wrap; gap: 12px; }\n<\/code><\/pre>\n\n\n\nDoes:<\/strong> Items wrap onto new lines automatically.
Use it:<\/strong> Tag lists, chips, card grids.<\/p>\n\n\n\n13) Equal Columns (Flex)<\/h2>\n\n\n\n.cols > * { flex: 1; }\n.cols { display: flex; gap: 1rem; }\n<\/code><\/pre>\n\n\n\nDoes:<\/strong> All children become equal-width columns.
Use it:<\/strong> Simple two\/three-column layouts.<\/p>\n\n\n\n14) Auto-fit Grid Cards<\/h2>\n\n\n\n.grid {\n display: grid;\n gap: 1rem;\n grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));\n}\n<\/code><\/pre>\n\n\n\nDoes:<\/strong> Responsive grid that adapts number of columns automatically.
Use it:<\/strong> Card layouts without media queries.<\/p>\n\n\n\n15) Sidebar Layout (Grid)<\/h2>\n\n\n\n.layout {\n display: grid;\n grid-template-columns: 280px 1fr;\n gap: 1rem;\n}\n@media (max-width: 900px) {\n .layout { grid-template-columns: 1fr; }\n}\n<\/code><\/pre>\n\n\n\nDoes:<\/strong> Sidebar + main content; collapses on small screens.
Use it:<\/strong> Dashboards, docs sites.<\/p>\n\n\n\n16) Full-Height App Shell<\/h2>\n\n\n\n.app { min-height: 100vh; display: grid; grid-template-rows: auto 1fr auto; }\n<\/code><\/pre>\n\n\n\nDoes:<\/strong> Header + main + footer, with main filling remaining height.
Use it:<\/strong> Pages where footer should sit at bottom.<\/p>\n\n\n\n17) Truncate Single Line<\/h2>\n\n\n\n.truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }\n<\/code><\/pre>\n\n\n\nDoes:<\/strong> Adds \u201c\u2026\u201d when text overflows one line.
Use it:<\/strong> Card titles, table cells.<\/p>\n\n\n\n18) Clamp to 3 Lines<\/h2>\n\n\n\n.clamp-3 {\n display: -webkit-box;\n -webkit-line-clamp: 3;\n -webkit-box-orient: vertical;\n overflow: hidden;\n}\n<\/code><\/pre>\n\n\n\nDoes:<\/strong> Limits text to 3 lines with truncation.
Use it:<\/strong> Previews, summaries.<\/p>\n\n\n\n19) Absolute Center (classic)<\/h2>\n\n\n\n.abs-center {\n position: absolute;\n inset: 50% auto auto 50%;\n transform: translate(-50%, -50%);\n}\n<\/code><\/pre>\n\n\n\nDoes:<\/strong> Centers an element inside its positioned parent.
Use it:<\/strong> Badges, overlays.<\/p>\n\n\n\n20) Safe Area Padding (iOS notch)<\/h2>\n\n\n\n.safe {\n padding: max(16px, env(safe-area-inset-top))\n max(16px, env(safe-area-inset-right))\n max(16px, env(safe-area-inset-bottom))\n max(16px, env(safe-area-inset-left));\n}\n<\/code><\/pre>\n\n\n\nDoes:<\/strong> Prevents content from hiding behind notches\/rounded corners.
Use it:<\/strong> Full-screen mobile layouts.<\/p>\n\n\n\n
\n\n\n\nSpacing, Sizing, and Units<\/h1>\n\n\n\n21) Consistent Section Spacing<\/h2>\n\n\n\nsection { padding-block: 4rem; }\n<\/code><\/pre>\n\n\n\nDoes:<\/strong> Adds vertical breathing room.
Use it:<\/strong> Marketing pages.<\/p>\n\n\n\n22) Fluid Spacing Scale<\/h2>\n\n\n\n:root {\n --space: clamp(1rem, 2vw, 2rem);\n}\n.card { padding: var(--space); }\n<\/code><\/pre>\n\n\n\nDoes:<\/strong> Padding grows slightly with screen size.
Use it:<\/strong> Cards\/containers.<\/p>\n\n\n\n23) Logical Properties (better for RTL)<\/h2>\n\n\n\n.box { margin-inline: auto; padding-inline: 1rem; }\n<\/code><\/pre>\n\n\n\nDoes:<\/strong> Works for left-to-right and right-to-left layouts automatically.
Use it:<\/strong> International-friendly layouts.<\/p>\n\n\n\n24) Square Avatar<\/h2>\n\n\n\n.avatar { width: 48px; aspect-ratio: 1; border-radius: 999px; object-fit: cover; }\n<\/code><\/pre>\n\n\n\nDoes:<\/strong> Perfect circles for images.
Use it:<\/strong> Profile pictures.<\/p>\n\n\n\n25) Responsive Images Crop<\/h2>\n\n\n\n.hero-img { width: 100%; height: 50vh; object-fit: cover; }\n<\/code><\/pre>\n\n\n\nDoes:<\/strong> Crops image to fill area without distortion.
Use it:<\/strong> Hero banners.<\/p>\n\n\n\n
\n\n\n\nColor, Backgrounds, and Effects<\/h1>\n\n\n\n26) Subtle Gradient Background<\/h2>\n\n\n\n.bg {\n background: linear-gradient(135deg, #0f172a, #111827 50%, #1f2937);\n}\n<\/code><\/pre>\n\n\n\nDoes:<\/strong> Adds depth without images.
Use it:<\/strong> Headers, hero sections.<\/p>\n\n\n\n27) Background Pattern (CSS-only dots)<\/h2>\n\n\n\n.dots {\n background-image: radial-gradient(#e5e7eb 1px, transparent 1px);\n background-size: 16px 16px;\n}\n<\/code><\/pre>\n\n\n\nDoes:<\/strong> Light dotted pattern.
Use it:<\/strong> Sections or cards (keep subtle).<\/p>\n\n\n\n28) Glassmorphism Card (simple)<\/h2>\n\n\n\n.glass {\n background: rgba(255,255,255,0.08);\n backdrop-filter: blur(10px);\n border: 1px solid rgba(255,255,255,0.15);\n border-radius: 16px;\n}\n<\/code><\/pre>\n\n\n\nDoes:<\/strong> \u201cFrosted\u201d glass effect on supported browsers.
Use it:<\/strong> Over background images\/gradients.<\/p>\n\n\n\n29) Soft Shadow<\/h2>\n\n\n\n.shadow {\n box-shadow: 0 10px 25px rgba(0,0,0,0.12);\n}\n<\/code><\/pre>\n\n\n\nDoes:<\/strong> Elevates elements without harsh edges.
Use it:<\/strong> Cards, modals.<\/p>\n\n\n\n30) Hover Lift<\/h2>\n\n\n\n.lift { transition: transform 160ms ease, box-shadow 160ms ease; }\n.lift:hover { transform: translateY(-4px); box-shadow: 0 14px 28px rgba(0,0,0,0.14); }\n<\/code><\/pre>\n\n\n\nDoes:<\/strong> Makes cards feel clickable.
Use it:<\/strong> Feature cards, product tiles.<\/p>\n\n\n\n
\n\n\n\nBorders & Shapes<\/h1>\n\n\n\n31) Nice Rounded Corners<\/h2>\n\n\n\n.round { border-radius: 16px; }\n<\/code><\/pre>\n\n\n\nDoes:<\/strong> Modern rounded look.
Use it:<\/strong> Buttons\/cards\/images.<\/p>\n\n\n\n32) Gradient Border<\/h2>\n\n\n\n.grad-border {\n border: 2px solid transparent;\n border-radius: 16px;\n background:\n linear-gradient(#fff, #fff) padding-box,\n linear-gradient(135deg, #60a5fa, #a78bfa) border-box;\n}\n<\/code><\/pre>\n\n\n\nDoes:<\/strong> Creates a gradient outline without extra wrappers.
Use it:<\/strong> Highlighted cards.<\/p>\n\n\n\n33) Dashed Divider<\/h2>\n\n\n\n.divider { border-top: 1px dashed #d1d5db; }\n<\/code><\/pre>\n\n\n\nDoes:<\/strong> Gentle separation.
Use it:<\/strong> Between sections or list items.<\/p>\n\n\n\n34) Fancy Corner Ribbon (badge)<\/h2>\n\n\n\n.ribbon {\n position: absolute; top: 12px; right: -40px;\n transform: rotate(45deg);\n padding: 6px 48px;\n background: #10b981; color: white;\n}\n<\/code><\/pre>\n\n\n\nDoes:<\/strong> Diagonal \u201cNEW\u201d\/\u201cSALE\u201d badge.
Use it:<\/strong> On cards with position: relative;<\/code>.<\/p>\n\n\n\n
\n\n\n\nTypography<\/h1>\n\n\n\n35) Font Smoothing + Base Type<\/h2>\n\n\n\nbody { font-family: system-ui, -apple-system, Segoe UI, Roboto, Arial, sans-serif; }\n<\/code><\/pre>\n\n\n\nDoes:<\/strong> Uses fast, clean system fonts.
Use it:<\/strong> Default typography for apps.<\/p>\n\n\n\n36) Better Headline Spacing<\/h2>\n\n\n\nh1,h2,h3 { line-height: 1.15; letter-spacing: -0.02em; }\n<\/code><\/pre>\n\n\n\nDoes:<\/strong> Makes headings feel tighter and more modern.
Use it:<\/strong> Marketing pages.<\/p>\n\n\n\n37) Balanced Text Wrap<\/h2>\n\n\n\nh1, h2 { text-wrap: balance; }\n<\/code><\/pre>\n\n\n\nDoes:<\/strong> Balances line breaks (supported in modern browsers).
Use it:<\/strong> Headlines so they don\u2019t look awkward.<\/p>\n\n\n\n38) Numerals Align Nicely<\/h2>\n\n\n\n.nums { font-variant-numeric: tabular-nums; }\n<\/code><\/pre>\n\n\n\nDoes:<\/strong> Makes digits equal width (great for tables\/counters).
Use it:<\/strong> Prices, dashboards.<\/p>\n\n\n\n
\n\n\n\nButtons & UI Components<\/h1>\n\n\n\n39) Solid Button<\/h2>\n\n\n\n.btn {\n padding: 10px 14px;\n border-radius: 12px;\n border: 1px solid #111827;\n background: #111827;\n color: white;\n cursor: pointer;\n}\n.btn:hover { opacity: 0.92; }\n<\/code><\/pre>\n\n\n\nDoes:<\/strong> Clean, modern button style.
Use it:<\/strong> Primary actions.<\/p>\n\n\n\n40) Outline Button<\/h2>\n\n\n\n.btn-outline {\n padding: 10px 14px;\n border-radius: 12px;\n border: 1px solid #cbd5e1;\n background: transparent;\n}\n.btn-outline:hover { background: #f1f5f9; }\n<\/code><\/pre>\n\n\n\nDoes:<\/strong> Secondary button look.
Use it:<\/strong> Less prominent actions.<\/p>\n\n\n\n41) Disabled Style<\/h2>\n\n\n\n