Skip to content
Novus Examples
css963 B

CSS — Component styles (variables, flexbox, keyframes)

A realistic component stylesheet using custom properties, flexbox, a fluid clamp() font size, color-mix(), a keyframe animation, and a media query — for testing CSS parsers, linters (stylelint), and highlighters.

Preview — first 50 linescss
/* Component styles: custom properties, flexbox, a fluid font size,
   a keyframe animation, and a media query. */
:root {
  --brand: #059669;
  --ink: #18181b;
  --radius: 8px;
  --gap: 1rem;
}

* {
  box-sizing: border-box;
}

.card {
  display: flex;
  flex-direction: column;
  gap: var(--gap);
  padding: var(--gap);
  border: 1px solid color-mix(in srgb, var(--ink) 12%, transparent);
  border-radius: var(--radius);
}

.card__title {
  margin: 0;
  color: var(--brand);
  font-size: clamp(1.1rem, 2vw, 1.5rem);
}

.button {
  align-self: flex-start;
  padding: 0.5rem 1rem;
  border: 0;
  border-radius: var(--radius);
  background: var(--brand);
  color: white;
  cursor: pointer;
  animation: fade-in 200ms ease-out;
}

.button:hover {
  filter: brightness(1.05);
}

@keyframes fade-in {
  from { opacity: 0; transform: translateY(4px); }
  to { opacity: 1; transform: translateY(0); }
}

@media (max-width: 480px) {
  .card {
54 lines total — download for the full file.

Specifications

Language
CSS
Kind
realistic snippet
Lines
53
Encoding
UTF-8
Line Endings
LF

What is a .css file?

CSS (.css) is a plain-text stylesheet describing how HTML elements are presented — colors, layout, typography, and responsive behaviour. It uses selectors paired with declaration blocks, and modern CSS adds custom properties (variables), flexbox and grid layout, and media queries.

How to use this file

Use an example .css file to test syntax highlighters, CSS parsers and minifiers, linters (stylelint), and pipelines that process or bundle stylesheets.

Generated by generation/code_samples.py. Free for any use, no attribution required — license.