John Cox

Blogs · @wyome

Tagged tips · everything

CSS Hacks

This article documents CSS hacks and filters—exploits of browser bugs and inconsistencies—that target specific browser versions, primarily Internet Explorer 6 and 7, with varying levels of reliability and validity. It categorizes recommended techniques like selector-based hacks (`* html {}`, `*:first-child+html {}`), attribute selector quirks, and the `!important` identifier abuse, alongside unrecommended methods using invalid CSS prefixes (`_property`, `*property`) and malformed pseudo-classes. The article emphasizes that while hacks should be avoided when possible, understanding these options allows developers to weigh consequences and choose the least harmful workarounds for cross-browser layout challenges.

Permalink

Super Stripes

This piece describes a practical web design technique for creating reusable stripe patterns using small transparent GIF images layered over different background colors in CSS. By preparing a few basic GIF files with alternating transparent and solid pixels, designers can quickly generate varied striped backgrounds across a website by simply changing the background-color property rather than creating new images for each color variation. The author suggests using this approach to visually distinguish different sections of a website while maintaining a cohesive design theme.

Permalink

Tips for getting to sleep faster & sleeping better

Josh describes his lifelong struggle with racing thoughts that keep him awake for hours despite not having clinical insomnia, then offers six practical remedies he's collected and tested. The advice ranges from avoiding screens thirty minutes before bed (because their light mimics daylight) to drinking milk for its tryptophan content, going to bed only when genuinely tired, reserving the bed primarily for sleep, practicing meditation or progressive muscle relaxation, and exercising during daytime rather than evening.

Permalink

.htaccess tricks and tips.. part one: tasty food for web serving thoughts.

This guide explains how to use .htaccess files—invisible configuration files placed on web servers—to control access permissions, customize error pages, password-protect directories, enable directory browsing, compress output to save bandwidth, and hide sensitive files from direct access. It covers practical directives like Allow/Deny rules, AuthType for password protection, ErrorDocument for custom error pages, and various PHP settings that can be configured at the folder level rather than requiring changes to the main server configuration. The author emphasizes testing changes on a local server first to avoid 500 errors and demonstrates how conditional blocks like `<ifModule>` can safely apply directives only when specific server components are available.

Permalink

Efficient CSS with shorthand properties | 456 Berea Street

CSS shorthand properties allow you to set multiple related values in a single declaration, significantly reducing file size and improving maintainability. The guide covers essential shorthands like margin and padding (which use the clockwise box model: top, right, bottom, left), borders (width style color), backgrounds (color image repeat attachment position), and fonts (style variant weight size/line-height family), noting that omitted values revert to their defaults. While browser support for shorthand value ordering is generally reliable, following W3C specification order is safest, and some properties like font-size and font-family are mandatory when using their shorthand equivalents.

Permalink