News.YC


2010-5-01 Distributing mixed-width items equally in HTML

See
this thread and this gist. Live example.

2009-01-16 Bookmarklet fix for News.YC PRE layout

Recently, followup posts to one of my comments triggered the News.YC layout bug where PREs can make a page arbitrarily wider. This ruined the width of not just that article but my threads page (at least until those exchanges scroll off the bottom).

Holding my breath for a server-side CSS fix has only produced dizziness with visual aura, so instead I made a bookmarklet which applies a crude CSS fix when clicked:

Bookmarklet: fixYCpre

Drag this to your bookmark bar, then click when encountering a PRE-overwide News.YC page. PRE elements will be restyled to a fixed width, and a hover-activated horizontal scrollbar will offer access to any overflow.

(The most important part is the applied 'max-width'. The 'padding' helps ensure the scrollbar appears even for 1-line PREs. The white 'background-color' is just a visual flourish I like.)

Confirmed working in FF3, Safari3, Chrome. Doesn't work in IE7 and life is too short to waste wrestling with IE eccentricities.