The web is an ever changing place to work as new methods and practices come in to standard practice and the older outdated processes are dropped. Tow of the largest changes in the pipeline that will affect virtually all web developers is the introduction of HTML 5 and CSS3.
Although the dates for introduction for these two are still a little way off many web developers are looking to find out the biggest changes and how they will affect the way they work. Instead of looking at both together, in this post we will look at some of the new features in CSS3 that will have the biggest impact.
Making rounded borders using CSS alone have never been an impossibility, but the ‘border-radius:’ property will easily allow web developers to utilise rounded corner designs with comparative ease without the need for a background image or using a ton of div tags. The code for rounded corners will be quite simple as well with very little code needed in comparison to previous methods (Example 1). Currently you’ll also need to include the –moz- prefix for Firefox support (Example 2).
You can also apply different radii’ to each corner using the individual border-radius properties: border-bottom-left-radius, border-top-right-radius, etc. Each property can accept either one or two values defined as either a percentage or length. When using two values to define the radius the first represent the horizontal radii and the second the vertical radii.
This can be further shortened to specify all four corners at the same time. The short hand property will accept one or two sets of values and each can contain one to four numerics. In this instance the first four sets of number set the border for the horizontal radii for all four corners, the additional 4 sets of numbers separated by the ‘/’ set the border for the vertical radii. If only one set of numbers is given then these figures are used to set both vertical and horizontal radii for all four corners. When all four values are given then these will represent the top left, top right, bottom right and bottom left respectively. If the bottom left is left out then the top right will be applied automatically and vice versa. If only one value is given it is used for all four corners.
Browser support for these new properties is still sketchy. See the below table for the W3C specification and the Mozilla alternative.
And they can be implemented together as shown in the following example:
-moz-border-radius: 10px 20px 10px 20px;
border-radius: 10px 20px 10px 20px;
I love opacity and have been using it in style sheets for some time. Web developers in the past would always have to use images to achieve the opacity effect or a combination of a colour value and an opacity value. It was an especially common effect used for rollover buttons. The opacity property in CSS3 has perhaps been the most widely embraced so far. Where as in the past developers would have to code opacity with a color value and an opacity value, developers can now utilise the opacity feature to specify the colour code and the opacity value at the same time. For example the following code would give you red at 20% opacity:
background: rgb(255, 0, 0) ; opacity: 0.2;
You can also use the new rgba feature to specify the colour and desired opacity at the same time. The below would also give you red at 20% opacity:
background: rgba(255, 0, 0, 0.2)
The difference between the two is that by using the opacity feature as in example one will apply the opacity to anything within the specified container, be it images, text, etc. Whereas, applying opacity as in the second example will apply the effect to the colour only and text and images within the same element will remain unaffected.
The box-shadow property is another feature that will please many developers as it allows you to apply a shadow to almost any non-text object on the page. In the past developers would have to create an image or images of the shadow and then line it up with the box to be pixel perfect, a process that was fairly time consuming. The box-shadow property eliminated the need for images and has the capability to display any colour shadow, set the position to left/right/up/down offset and you can also adjust the amount of blur, all through CSS3. The following diagram taken from W3C displays quite well the effects the code that can be used:
In the past applying a shadow to text has only been achievable through photoshop and displaying the test as an image. With the new CSS3 text-shadow property, shadow can be applied to any text on screen with only a few lines of code:
text-shadow: 2px 2px 2px #000;
The above code will give you a taste of how to apply a simple text-shadow effect. Try the below code for a truly amazing effect.
Web fonts have been about for quite a while now, in fact as far back as 1997 when they were first proposed for CSS2. The only browser to offer limited implementation was Internet Explorer since version 5. However, with this new feature in CSS3, any TrueType or OpenType font can be used to display text on websites. In the past, if a web design called for a non standard web-safe font had to be rendered as an image first and displayed as such which led to increased load times and text on the page that search engines couldn’t read. With CSS3 you can upload TrueType or OpenType fonts to you server, declare them in your style sheet using the [email protected] rule and you’re away. For example:
Mouseover to see this author's bio. Nisha is the head blogger for Slodive.com. She loves tattoos and inspirational quotes. Check her out on google plus https://plus.google.com/u/0/116437517919411097994.Nisha Patel's Archive