DEV Community

Cover image for ChocoDEV: a chocolate bar you can eat, in pure CSS
Vinicius Pereira
Vinicius Pereira

Posted on

ChocoDEV: a chocolate bar you can eat, in pure CSS

Frontend Challenge CSS Art Submission 🍲🥧

This is a submission for Frontend Challenge: Comfort Food Edition, Perfect Landing.

What I Built

ChocoDEV is a landing page for a chocolate brand that does not exist, and I am fine with that. Chocolate is my comfort food, and it turns out it is also South America's: the oldest traces of cacao were found in the upper Amazon, which as a Brazilian I consider a home win.

The page has one rule: zero images. No PNGs, no SVGs, no background URLs. Every square of chocolate, every drip, every bevel is gradients, box-shadow and keyframes. The footer makes the claim and devtools can check it, which is my favorite kind of claim.

The centerpiece is a chocolate bar you can actually eat. Each chunk is a button, each bite updates a counter, and when the bar is gone you get to bake a new one. There is also an exploded anatomy view of a single square, a scroll progress bar, and a testimonials section where four honest people confess things about chocolate that most of us only think.

Demo

Live demo: vinimabreu.dev/chocodev

Click a chunk of the bar. The counter is watching.

The ChocoDEV bar with three chunks eaten and a bake a new bar button

Journey

The zero images rule sounded like a gimmick and turned into the whole education. A believable chocolate square needs light coming from somewhere, and without images that means layered box-shadows: an inset highlight on top, an inset shadow at the bottom, a drop shadow below. Once the light direction was consistent, everything suddenly looked edible. Before that it looked like brown buttons.

Exploded anatomy view of a chocolate square, five labeled layers

The part I am most proud of is not visible. The page respects prefers-reduced-motion in three places: the CSS animations, the stat counters that jump straight to their final value instead of counting up, and the parallax that simply declines to run. Every interactive element is a real button with a name a screen reader can speak, the document has a language and a title, and the menu wraps instead of clipping on narrow screens. Accessibility is a judging criterion in this challenge, and I think it should be the first one: a landing page that only works for some visitors is a poster.

Four flavor cards: Amazonia 70, Milk and Sea Salt 55, Caramel Crunch 64, Midnight Compile 100

What I would do next: a dark and milk chocolate theme toggle, and sound on the snap. Probably a mistake. Most good ideas about chocolate are.

Thanks for reading, and go eat something that makes you feel at home.

Top comments (0)