Category: css
How Cascading Style Sheets are implemented in current browsers, what we can do with the language, and what to look forward to.
How Cascading Style Sheets are implemented in current browsers, what we can do with the language, and what to look forward to.
This is such a clever idea: a stylesheet which highlights common HTML problems, helping you QA your sites before you publish them. Nice work by Jens Meiert.
I was admiring the layout of a front page splash of a newspaper supplement yesterday, and realised that with (some) modern browsers we can replicate the effect using CSS alone. I’ve knocked together a quick demo using the transform property which is available in Firefox 3.5 and Safari 4.
The best thing about it is that it uses only a single block-level element, so nicely degrades to a heading only.
The latest alpha release of Firefox 3.6 (3.6a1) contains some new rules for providing backgrounds to elements: multiple background images, background-size, and an implementation of the Webkit gradient proposal (modified from the original – more on that later).
I’ve put together a very rough demo of what you can do with these new rules; you’ll require a recent build of Firefox 3.6 or Webkit to view it. Try resizing the window to different dimensions, and see how it changes.
Here’s an explanation of how I did it:
Firefox 3.6 has become the latest browser to support the CSS3 background-size property (although the first to do so according to the latest W3C spec.).
Using it is pretty simple:
div {
background-image: url('image.png');
-moz-background-size: 80%;
}
This, along with multiple background-images, is going to go a long way towards cleaning up mark-up and prettifying the web.
There’s so much great stuff written about web standards available for free on the web that it’s easy to forget how much bad stuff is also out there; and how many people are willing to support it just because it’s easier than putting in a little extra effort to follow best practice.
Over the weekend one of the most popular stories on Delicious.com was teaching the use of lazy CSS hacks, the type of which I thought everybody was convinced enough to do away with; the star and underscore hacks for targeting IE6 & IE7, the hacks which we’ve been saying (for years) shouldn’t be used anymore.
Disregarding the ‘rights’ and ‘wrongs’, and the validation argument – some of my stylesheets don’t validate, and there are good reasons for that – I’d like to give a few other reasons why using this method is not a good idea.
Firefox 3.5 was released earlier today, and joins Safari in supporting the @font-face rule with OpenType and TrueType font families, allowing you to use a wider range of fonts in your designs (as long as they are correctly licensed, of course).
One slight drawback of the technique is the blank space that’s displayed as the new font is loaded into the browser; this is especially unnecessary for users who already have that font natively on their system.
The way to get around that is quite simple; use local() to check if the font is on the user’s system first.