Archive for the 'CSS' Category

CSS3 Rounded Corners: Avoiding Image Clipping Problems

The Scenario

Consider the following HTML+CSS setup: an img element wrapped in a div container with rounded corners (and optionally, a drop shadow); the div is sized to match the image’s dimensions, like so:

<!-- HTML -->

<div class="rounded">
    <img src="…" height="50" width="100" />
</div>
/* CSS */

div.rounded {
    border-radius: 5px;
        -moz-border-radius: 5px;
        -webkit-border-radius: 5px;
    box-shadow: 0 0 5px rgba(0, 0, 0, 0.65);
    height: 50px;
    width: 100px; }

The Problem

If you’ve been playing around with CSS3 long enough, chances are you’ve already encountered this common problem: the corners of the image don’t get clipped by the container, although the container’s corners are rounded. A perfectly logical outcome, considering the box model behavior and element hierarchy, but in most cases, it’s not what we want for our layout. Continue reading ‘CSS3 Rounded Corners: Avoiding Image Clipping Problems’

Multibox: Troubleshooting Checklist

I ran into Phatfusion‘s Multibox while looking for a way to display MOV files in a lightbox fashion. I know, there are probably better ways to do it, but I was pressed for time, and Multibox happened to be sitting in the first page of my search results, so I went with that. Continue reading ‘Multibox: Troubleshooting Checklist’

Are Vista Fonts Ready for the Web?

Windows Vista™ ushered in a new set of screen-optimized typefaces, touted as successors to the Core Web fonts we’ve all become accustomed to. Already, we’ve seen early adopters and trendsetters updating their font-familys to prioritize the newer fonts (Calibri, Cambria, and Segoe UI being current favorites).

Continue reading ‘Are Vista Fonts Ready for the Web?’

Lucida Hybrid: The ‘Grande’ Alternative

Lucida Grande is such a nice font to use in websites, but because it doesn’t come standard with Windows, we turn to Lucida Sans Unicode and Lucida Sans to make sure users get a similar look. Unfortunately, both typefaces have imperfections that make them less-than-worthy candidates for substitution. Oh, dear.

Continue reading ‘Lucida Hybrid: The ‘Grande’ Alternative’

CSS First-Aid for IE Peekaboo Bug

That annoying IE peekaboo bug just doesn’t know when to stop. Apparently, even IE7 exhibits this bug, and it appears to be worse than its predecessor. If you happen to be pressed for time (or are lazy to search the Internets for a solution), applying a couple of stylesheet rules to the affected element should solve most peekaboo problems for both IE6 and IE7:

position: relative; /* peekaboo bug fix for IE6 */
min-width: 0; /* peekaboo bug fix for IE7 */

Continue reading ‘CSS First-Aid for IE Peekaboo Bug’