If you are into CSS3 you need to see this. Lea points out some uber-useful things.
Lea Verou | CSS3 Secrets: 10 things you might not know about CSS3 | Fronteers 2011 from Fronteers on Vimeo.
If you are into CSS3 you need to see this. Lea points out some uber-useful things.
Lea Verou | CSS3 Secrets: 10 things you might not know about CSS3 | Fronteers 2011 from Fronteers on Vimeo.
Opera 12 is knocking at the doors and it bring couple of nice new features like new HTML5 parsing engine called Ragnarok and native support of CSS radial gradients, wich I’d like to introduce a little.
Opera supports CSS linear gradients since version 11.10 and time has come to take CSS3 gradients to new level. Finally. Alpha version of Opera 12 brought possibility to define radial gradients using same syntax firefox and chrome browsers are using.
And this is how you do it:
/* General syntax looks like this */
E {background-image: -o-radial-gradient(position,size and shape,colour stops);}
I recently added a somewhat bigger chunk of code to my main project and once I made update available for testing, people started to ask me, why pages are no longer working in IE8 (nor IE6 and IE7 for that matter).
My first thought was, that I my update screwed something up. I checked the code like a hundred times, but never find anything wrong. Interesting part was, that only compressed one-file version of CSS was refusing to work. When I offered several raw source files to IE8, it worked like a charm. And that’s when I started to suspect it. Continue reading
HTML5 offers quite a few new semantic tags, that need to be taken into account and used very wisely. Learning them is not the easiest thing in the world and this fact is proved by number of articles already covering “common mistakes” in HTML5. Thanks to @webMarek I found a site called HTML5 Doctor with loads of great articles clarifying a thing or two about our latest doctype. Few months back, inspired by one of their readers, creators of HTML5 Doctor made a flowchart featuring HTML5 elements, which should help you make you code more aligned with W3c standards and semantics and overall less evil.
Image below is the Flowchart. Yes. And don’t forget to visit the source: http://html5doctor.com/happy-1st-birthday-us/.
A year ago a thing called HTML5 Boilerplate appeared and I am sure you’ve heard of it quite a lot. It’s a base HTML/CSS/JS template for a fast, future-proof, robust and giant-robot-killing-laser-eyed site and perhaps I will write an article about it one day. In second release, that came out just few days ago one new feature caught my attention. It’s called Normalize.css and it is a replacement of old CSS Reset.
Normalize.css brings all advantages of CSS reset philosophy and (almost) none of its weaknesses. As you know, CSS reset was there to remove all browser styling and make all HTML elements render the same across the browsers. If you haven’t modified the code and you used it out of the box you lazy thing, you ended up with HTML elements with no styles whatsoever. This, for example, forced you to restyle your form elements from the ground up. After a rage over CSS reset technique lots of people (finally) realized, that using such hardcore CSS reset has to be done with caution (not that Eric Meyer wouldn’t mention it) and new approaches to base CSS code begin to emerge. The best example I found so far is Normalize.css.
We all know browser specific CSS for IEs. But what happens, if one of the big guys like Chrome, Safari or Firefox starts behaving badly? Fortunately, there are few tricks to rule them all. (no, not the ring thing you nerd!)
Here is neat CSS trick that targets browsers with webkit rendering engines, e.g. Chrome and Safari. Works like a charm.
.hackedElement {
background: #fff; /* for Life, the Universe and Everything */
}
@media screen and (-webkit-min-device-pixel-ratio:0) {
.hackedElement {
background: #eee; /* for Chrome and Safari */
}
}
Admit it. Browser specific CSS hacks saved your sanity quite a few times. Especially dealing with that thing Microsoft dares to call browser! Yeah, I am looking at you IE6/7/8. Anyway, I’ve thrown together couple of examples of CSS rules, that helps you target different version of Internet Explorer.
Note: This may not a complete list of possible hacks. I just picked ones, that proved to be most useful.
.hackedElement {
background: #fff; /* for Life, the Universe and Everything */
background: #eee\9; /* IE 9 and below */
background: #ddd\0/; /* IE 8 only - might not work with all attributes (lovely, isn't it?) */
*background: #ccc; /* IE 7 and below */
_background: #bbb; /* IE 6 and below */
_bac\kground: #aaa; /* IE 6 only */
}
/*
asterisk attribute usually works for both IE7 and IE6,
however selector of direct child ">" is not supported by IE6,
so CSS below gets rendered only by IE7
(note: missing parent tag before ">" is automatically substituted by "*")
*/
> body .hackedElement {
*background: #ccc; /* only IE 7 */
}
Asking yourself who, in the world, could invent such hacks and even implement them into IEs? Well, I can just say, that not all of us had luck of having a loving mother.
Though, I am Opera fan, I couldn’t wait for Firefox 4 release as it brings one of the most exciting CSS3 features I’ve ever used. This new cool thingy is called CSS transitions which is, in other words, animations purely trough CSS. I bet you remember those nights when you wrote quite a few lines of JavaScript to make items fade in/out and how happy you were, when jQuery appeared. These basic animations can be now easily created via CSS.
Opera finally supports native CSS gradients and I don’t mean that nasty solution using SVG. There is one limitation, though. For now, there is support for linear gradients only, so no radial ones will be displayed.
Note: At the time of writing this article, CSS gradients were supported in beta version of Opera 11.10 Baracuda. All stable versions 11.10 and up will support this.
Recently I saw number of articles describing cross browser CSS3 techniques, that were not really taking into account all browser that they should. OK, I admit, maybe they’ve addressed all relevant browsers, but still – it won’t hurt to know couple more solutions. So here are my a-bit-more-cross-browser CSS gradients.
Updated: Opera 11.10 Baracuda supports native CSS gradient. Read full story.