The 26 capital letters of the English alphabet, drawn with HTML and CSS alone — no images, SVG, or fonts — with the code for every letter one click away.
I built this to practise four CSS techniques by drawing every letter with them: pseudo-elements, borders and box-shadow, positioning, and transforms. Each letter's code can be viewed and copied, so anyone learning those techniques can see exactly how it's made.
On the live site, select any letter. A dialog shows it large, with two tabs:
- HTML: the markup for the letter, usually one or two elements.
- CSS: every rule that draws it, plus the 240×240 box it sits in and the
--inkcolour variable.
Copy both into any page and the letter renders. Change --ink to recolour it. Each letter also has its own link, such as letters-with-css.vercel.app/#S.
The CSS tab is read from the live stylesheet, so it always matches what's drawn.
Every letter is one or two elements inside a 240×240 box, shaped with only these techniques:
::beforeand::afterpseudo-elements, for the extra strokes a single element can't make.- Borders and
box-shadow, for strokes, curves, and the counters inside letters like O and D. - Relative and absolute positioning, to place each piece.
- Transforms, to rotate and skew the diagonals in letters like A, N, and W.
There's no build step. Clone the repo:
git clone https://github.com/Timonwa/letters-with-css.git
cd letters-with-cssThen serve the folder, either way works:
- VS Code: open the folder, install the Live Server extension, and click Go Live in the status bar.
- Terminal: run
npx serveand open the URL it prints.
Use a server rather than opening index.html directly: browsers block the code viewer from reading the stylesheet on file:// pages.
| File | What it holds |
|---|---|
style.css |
The letters: every rule that draws A to Z |
site.css |
The page: layout, tiles, dialog, and colours |
app.js |
The code viewer: opens a letter and builds its HTML and CSS |
index.html |
The page markup, metadata, and the 26 letters |
og.png |
The image shown when the site is shared |
- Shapes with CSS: 26 shapes, from a circle to a magnifying glass, drawn in pure CSS (source).
- JavaScript Project Series: 10+ beginner JavaScript projects, each with a step-by-step tutorial (source).
MIT © Timonwa Akintokun
