frontpage.
newsnewestaskshowjobs

Made with ♥ by @iamnishanth

Open Source @Github

fp.

Open in hackernews

Fizz Buzz in CSS

https://susam.net/fizz-buzz-in-css.html
24•froober•2h ago

Comments

kevinsync•49m ago
I love this, it's a very clever and funny way to solve the problem. Makes me think about how there are infinite routes from A to B, some more scenic and whimsical than others.. as well as all the people I've met along the way who would be so pissed and pedantic about how this isn't a "real solution" LOL
susam•45m ago
A shorter solution is possible with an ordered list (<ol>) if we're willing to ignore the untidy output:

  li:nth-child(3n), li:nth-child(5n) { list-style: none }
  li:nth-child(3n)::before { content: "Fizz" }
  li:nth-child(5n)::after { content: "Buzz" }
Example: https://susam.net/code/web/css-fizz-buzz-ol.html

  $ curl -sS https://susam.net/code/web/css-fizz-buzz-ol.html | sed -n '/none/,/after/p' |  tr -d '[:space:]' 
  li:nth-child(3n),li:nth-child(5n){list-style:none}li:nth-child(3n)::before{content:"Fizz"}li:nth-child(5n)::after{content:"Buzz"}
  $ curl -sS https://susam.net/code/web/css-fizz-buzz-ol.html | sed -n '/none/,/after/p' |  tr -d '[:space:]' | wc -c
  129
But I don't quite like how misaligned the numbers and the words look in this version. Correcting that would call for extra code that would cancel out the bytes saved.
cluckindan•23m ago

    list-style-position: inside;
susam•12m ago
Yes! However, like I mentioned in my previous comment, corrections like this cancel out the number of bytes saved with the <ol>-based solution.

I mean, the solution in the original post is 152 characters long.

The <ol> based solution is 129 characters long. Shorter but uglier.

If we add your correction, we get neater output but at the cost of 30 additional characters in the minified code thereby making the solution 159 characters long.

  li { list-style-position: inside }
  li:nth-child(3n), li:nth-child(5n) { list-style: none }
  li:nth-child(3n)::before { content: "Fizz" }
  li:nth-child(5n)::after { content: "Buzz" }
carl_dr•41m ago
Ignoring the size of the HTML in addition to the CSS, it’s fun, but not really fair when talking about code golf. Beyond a few numbers, you need to include some JavaScript and generating a million list elements. But those bytes count …

Netflix to Acquire Warner Bros

https://about.netflix.com/en/news/netflix-to-acquire-warner-bros
1289•meetpateltech•9h ago•1037 comments

Frank Gehry has died

https://www.bbc.co.uk/news/articles/c5y2p22z9gno
19•ksajadi•48m ago•4 comments

Cloudflare outage on December 5, 2025

https://blog.cloudflare.com/5-december-2025-outage/
461•meetpateltech•6h ago•320 comments

Gemini 3 Pro: the frontier of vision AI

https://blog.google/technology/developers/gemini-3-pro-vision/
228•xnx•6h ago•108 comments

Framework Sponsors CachyOS

https://discuss.cachyos.org/t/framework-sponsorship-for-cachyos/19376
92•d3Xt3r•2h ago•62 comments

Idempotency Keys for Exactly-Once Processing

https://www.morling.dev/blog/on-idempotency-keys/
41•defly•4d ago•9 comments

Patterns for Defensive Programming in Rust

https://corrode.dev/blog/defensive-programming/
148•PaulHoule•5h ago•30 comments

A $20 drug in Europe requires a prescription and $800 in the U.S.

https://www.statnews.com/2025/10/31/why-miebo-costs-40-times-more-than-its-european-version/
46•geox•52m ago•20 comments

I'm Peter Roberts, immigration attorney who does work for YC and startups. AMA

144•proberts•6h ago•171 comments

Fizz Buzz in CSS

https://susam.net/fizz-buzz-in-css.html
27•froober•2h ago•5 comments

Most technical problems are people problems

https://blog.joeschrag.com/2023/11/most-technical-problems-are-really.html
269•mooreds•9h ago•231 comments

Show HN: HCB Mobile – financial app built by 17 y/o, processing $6M/month

https://hackclub.com/fiscal-sponsorship/mobile/
74•mohamad08•2d ago•17 comments

Why we built Lightpanda in Zig

https://lightpanda.io/blog/posts/why-we-built-lightpanda-in-zig
124•ashvardanian•3h ago•60 comments

Judge Signals Win for Software Freedom Conservancy in Vizio GPL Case

https://fossforce.com/2025/12/judge-signals-win-for-software-freedom-conservancy-in-vizio-gpl-case/
64•speckx•1h ago•4 comments

Perpetual Futures

https://www.bitsaboutmoney.com/archive/perpetual-futures-explained/
4•sirodoht•56m ago•0 comments

Making RSS More Fun

https://matduggan.com/making-rss-more-fun/
164•salmon•9h ago•86 comments

Onlook (YC W25) the Cursor for Designers Is Hiring a Founding Fullstack Engineer

1•D_R_Farrell•5h ago

Tides are weirder than you think

https://signoregalilei.com/2025/11/12/tides-are-weirder-than-you-think/
18•surprisetalk•4d ago•3 comments

Advertising as a major source of human dissatisfaction (2019) [pdf]

https://www.andrewoswald.com/docs/AdvertisingMicheletal2019EasterlinVolume.pdf
153•anigbrowl•2h ago•126 comments

UniFi 5G

https://blog.ui.com/article/introducing-unifi-5g
334•janandonly•15h ago•272 comments

Compassionate Curmudgeon: Why we must root ourselves in the real world

https://theamericanscholar.org/compassionate-curmudgeon/
22•lermontov•3d ago•4 comments

Show HN: Kraa – Writing App for Everything

https://kraa.io/about
98•levmiseri•1d ago•56 comments

Netflix’s AV1 Journey: From Android to TVs and Beyond

https://netflixtechblog.com/av1-now-powering-30-of-netflix-streaming-02f592242d80
485•CharlesW•22h ago•252 comments

Show HN: SerpApi MCP Server

https://github.com/serpapi/serpapi-mcp
20•thefoolofdaath•3h ago•3 comments

Framework Laptop 13 gets ARM processor with 12 cores via upgrade kit

https://www.notebookcheck.net/Framework-Laptop-13-gets-ARM-processor-with-12-cores-via-upgrade-ki...
247•woodrowbarlow•6h ago•121 comments

BMW PHEV: Safety fuse replacement is extremely expensive

https://evclinic.eu/2025/12/04/2021-phev-bmw-ibmucp-21f37e-post-crash-recovery-when-eu-engineerin...
407•mikelabatt•21h ago•459 comments

Synadia and TigerBeetle Pledge $512k to the Zig Software Foundation

https://tigerbeetle.com/blog/2025-10-25-synadia-and-tigerbeetle-pledge-512k-to-the-zig-software-f...
147•cratermoon•5h ago•60 comments

Building a Copying GC for the Plush Programming Language

https://pointersgonewild.com/2025-11-29-building-a-copying-gc-for-the-plush-programming-language/
20•ibobev•4d ago•1 comments

Nimony (Nim 3.0) Design Principles

https://nim-lang.org/araq/nimony.html
119•andsoitis•3d ago•75 comments

The Forgotten Roman Ruins of the ‘Pompeii of the Middle East’

https://news.artnet.com/art-world/huge-jerash-jordan-pompeii-middle-easy-2708480
47•pseudolus•6d ago•10 comments