Skip to content
Novus Examples
css205 B

CSS — Hello World

A minimal stylesheet that centres a heading with grid — the simplest useful CSS file for testing highlighters, CSS parsers, and minifiers.

Preview — first 13 linescss
/* A minimal stylesheet: center a heading on the page. */
body {
  margin: 0;
  min-height: 100vh;
  display: grid;
  place-items: center;
  font-family: system-ui, sans-serif;
}

h1 {
  color: #059669;
}

Specifications

Language
CSS
Kind
hello-world
Lines
12
Encoding
UTF-8
Line Endings
LF

Testing contract

Expected to pass
Scenario
Parse the stylesheet and count the rules a CSS parser reports.
Expected result
Two rule sets parse - `body` and `h1` - with five declarations on `body` and one on `h1`; there are no at-rules, no custom properties and no vendor prefixes, so a minifier's output should differ only in whitespace.

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.

How to use this file for testing

“CSS — Hello World” is a deterministic Novus Examples fixture for Syntax highlighting, Code parsing, Editor testing. Idiomatic hello-world programs and realistic snippets across sixteen languages, exercising comments, string escapes, interpolation, numeric literals, and language keywords — for testing syntax highlighters, editor themes, and tree-sitter grammars.

Documented properties for this file: CSS · UTF-8 · LF. Compare results against paired or grouped companions on this page when present (clean↔damaged, searchable↔scanned, or format twins) so scores stay reproducible across runs.

Download the file once, keep the path stable in CI or local scripts, and treat the spec table as the contract: dimensions, seeds, field lists, and roles are intentional. Corrupt or invalid samples are labelled as such — expect parsers to fail loudly rather than silently accept them.

This is a short, known-correct source file. Run it through your syntax highlighter, linter, formatter, tree-sitter grammar, or parser, and open it in the in-browser editor to tweak and re-download. Each snippet exercises comments, string escapes, literals, and language keywords.

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