There are several features of CSS3 that are implementable today. In this presentation we discuss CSS3 Selectors, Text Shadows, Box Shadow, Rounded Corners (prefixed), @font-face, Alpha Transparency, Opacity, Rotation. Mostly, there are links to my sandboxing of those features.
If it’s not successfully embedded, you can see it here css3 implementable features
Content covered in the PPT presentaion
I do not have a podcast, but here is a summary of what was presented in case you missed it, or incase the flash above isn’t enough
CSS3: Si se puede
has been around since 1999, but only fully supported in IE8. We obviously didn’t wait to implement CSS2 until all the browsers fully supported it. CSS3, while not yet finalized, has a lot of features that are supported in many browsers. Like CSS 2.1, there is no reason not to use these features just because not all browsers support all the features equally: if that were our logic, we would still be on CSS1.
Your site does not need to be identical in all browsers
In developing with CSS3 think about graceful degradation. Not all browsers need to implement your site identically. Yes, your site should look good in all browsers, but no, if your body is a few pixels different in one browser to the next, who cares? You’re the only one who is going to be looking at your website in multiple browsers at the same time. 99.99% of the site user base (that number is pulled out of my ass) have one favorite browser on their desktop, and that’s what they’ll use to look at your site.
Example: Twitter uses native rounded corners for supporting browsers.
IE does not support rounded corners. Twitter believes that rounded corners make their site look nicer, but lack of them doesn’t break the site. So, the experience is a little different in the IE’s than in modern browsers. But if I hadn’t shown you this example, you may never have known!
Twitter would have had a difficult time creating rounded corners with images since the background color of the right hand nav bar on twitter is user selectable. They could have created rounded corners on the left and square angles on the right, but likely going all square for IE looked better.
For the rest of the examples, I’ll be explaining how to make CSS3 work in IE. I just want to spread the gospel that it doesn’t have to look identical anyway.
Features that are implementable and discussed below:
- CSS3 Selectors
- Text Shadow (2.0).
- Box Shadow (prefixed)
- Rounded Corners (prefixed).
- Alpha Transparency.
Features that are implementable, but not discussed in this talk
- Multi-column layout
- Video (HTML5)
- Multiple background images
- Linear Gradients
If you look at the grid of CSS3 Selectors and Browser Support, you’ll note that, at this point, only the three IEs don’t understand CSS3 selectors. That doesn’t mean you can’t use them.
To see all the selectors, and what you can and cant use, check out CSS3 Selectors and Browser Support
color: hsla(300, 100%, 50%, 0.4);
HSL stands for hue, saturation and lightness. The HSL format simplifies color palette creation as you can pick a hue as the base, then manipulate the lightness/darkness and saturation of the hue selected.
HSL is a new color type added in CSS3, stading for hue, saturation and lightness. The syntax is similar to rgb(), but instead of including the values for red, green and blue, the color value accepts values in degrees from 0 to 359 for hue, and percentages for saturation and lightness, with 50% being the norm for lightness and 100% being the norm for saturation. Lightness of 0% will be white, 50% will be the actual hue, and 100% will be black. Saturation of 100% will be the hue, and saturation of 0 will give you a shade of grey from white to #808080 to black depending on the lightness.
Values for hues include: 0 = red, 60 = yellow, 120 = green, 180 = cyan, 240 = blue, 300 = magenta, and everything in between.
Similar to rgb() with rgba(), hsl() also has an alpha transparent call, hsla(). the syntax is hsla, followed by hue in degrees, saturation in percentage, lightness in percentage and alphavalue from 0-1, encompassed in parenthesis.
For example: hsla(300, 100%, 50%, 0.5) is magenta at 50% opacity.
Opacity likely doesn’t have the impact you intended. The element made less that fully opaque is not the only element impacted. All the element with a z-index higher than the one made opaque inherit the same level of transparency. Generally, you’ll want to use alpha transparency on a background rather than opacity.
The order is topleft, topright, bottomright, bottomleft.
Safari has some issues with rounded corners.
$('.rounded').append('<b class="tr"></b><b class="tl"></b><b class="br"></b> <b class="bl"></b>');
text-shadow: 3px 3px 3px rgba(0,0,0,0.4);
In the above, the order of values is
leftOffset rightOffset blur Color
If you’re going to use text shadow, which is not supported in IE, this is a good time to use the Hack for CSS3 Supporting Browsers. As I mention in that article, you don’t want to end up with white text on white background.
Transforms are supported in all browsers, just with different syntax.
Note that for IE, the values are 1=90, 2=180, 3=270. Check out my
sandbox, or just look at the header of this blog.
I’ve been told that IE supports more than just the 90degree angles, but haven’t tested yet. The syntax is:
filter: progid:DXImageTransform.Microsoft.Matrix(sizingMethod='auto expand',
M11=6.123233995736766e-17, M12=-1, M21=1, M22=6.123233995736766e-17); /* for IE6 and IE7 */
-ms-filter: "progid:DXImageTransform.Microsoft.Matrix(SizingMethod='auto expand',
M11=6.123233995736766e-17, M12=-1, M21=1, M22=6.123233995736766e-17)"; /* for IE8 */
and make sure that the element hasLayout.
I didn’t actually go over gradients in my presentation, but linear gradients are supported in one way or another in all browsers except opera, so you can use them. Radial gradients …. not yet.
background-image: -moz-linear-gradient(top, #56abf3, #ffffff, #ffffff, #ffffff); /* FF3.6+ */
background-image: -webkit-gradient(linear,left top,left bottom,color-stop(0, #56abf3),color-stop(25%, #ffffff));
Filter: progid:DXImageTransform.Microsoft.gradient (GradientType=0, startColorstr=#FF56abf3, endColorstr=#FFFFFFFF)
There are two types of Gradients – 0 gives a gradient running from top to bottom. 1 from left to right.
startColorstr — The start color of the gradient. The first 2 characters in the 8 digit HEX color number are the Alpha values ( 00 being transparent, FF is opaque). Default is blue
endColorstr= — The color of the bottom or right end of the gradient, depending on what GradientType you use. The default color is black #FF000000 if omitted.
There are no colorstops in IE as far as i can tell