Tag Archives: CSS

Setting CSS Background Colors via Javascript – RGB triplet vs Hex

10 Oct 2012

We’ve all had to do it – change the color of text or visible html elements like Div backgrounds or borders, etc. One thing I’ve noticed is that when I request the background color of a Div I get the RGB triplet, not a hexadecimal value. Observe this example: (Please use a modern browser, I’ve […]

Read More

Mobile-Specific Style Sheets

28 Aug 2012

Here’s a brief snippet of code that I just wrote to handle serving up style sheets for a mobile project – it detects iOS, Android, iPhone and iPad allowing you to write in platform/device-specific style sheets into your HTML documents. This is a self-invoking function, simply paste into the head of your document and you […]

Read More

Mobile Safari Debug Console Breaks @Media Query

03 Jul 2012

Spent a lot of time spinning my wheels on this – in these cases you always think about whats changed since the last time your layout did what you wanted…and I backed up all the way to settings I enabled/disabled on the iPhone, and found the issue! If you’re using an @media query like the […]

Read More

Scaling Fixed Background Images

08 Jun 2012

I recently built a page template for a friend that required a static background image that scaled with the browser window while keeping the image’s aspect ratio intact. The challenge was more about getting it to display properly in IE 7 and 8. In the end there are a combination of approaches here – one […]

Read More

Vertical Text Align Issue In Chrome

24 May 2012

(UPDATE: The good people at chromium have pointed out that Safari 5 fails on this too, and so this is a WebKit error not unique to Chrome). Stumbled upon this one today in Chrome (submitted to the Chrome bug list on 7/3/12) – given the right set of circumstances vertical text alignment of italicized text […]

Read More