Cool Link Roundup

A bunch o’ interesting links I’ve happened across recently:

Proportional Image Scaling in CSS

While you should always use the appropriately-sized images on websites (rather than serving 10-megapixel images on your pages — people actually do that!), when dealing with dynamic content, sometimes it’s nice to ensure that images don’t expand beyond their container.

That’s easily solved with setting a max-width value in the CSS on my other blog, but the problem was that this seemed to only adjust the width. I wanted to scale images proportionally, so if an image that was too big made it through, it wouldn’t look awful.

It turned out to have a really easy fix — but it was astonishingly hard to find information on. Here’s the fix:


img {
  max-width: 100%;
  height: auto;
}

The “height: auto” is the key, making height proporational when it is resized. (The “100%” in max-width gets interpreted as 100% of the element it’s contained in, not 100% of the image itself.)

John McAfee Hides in Cardboard Box

Link

In what sounds more like a drug-fueled hallucination than an actual news story, John McAfee, of McAfee anti-virus fame, is on the run after his neighbor in Belize turned up dead. He maintains his innocence, but believes that the police have a vendetta against him, so he has slept on lice-infested beds and hidden in cardboard boxes buried in the sand. Wait, what?