Login Form



A new feature of CSS3 is the ability to create rounded corners with border commands. This is one of my personal favourites, which whilst doing nothing for functionality - does contribute to the aesthetics of a rendered page.

The official style command is border-radius. Both Mozila/Firefox and Safari 3 have had the foresight to implement this feature set, which allows you to create round corners on boxes, which means I can demonstrate the coding now without waiting for the official launch of CSS3. Please don't write to complain that you cannot see this effect in Internet explorer as IE has yet to implement the function.

Here is an example:

Sadly Internet Explorer users will see a standard square cornered box, however those lucky Mozilla/Firefox and Safari 3 users should see a rounded box, with a fabulously curvy border!

 

The code for this example above is actually quite simple:

<div style="border: 2px solid #ea791e; padding: 20px; -moz-border-radius: 15px; -webkit-border-radius: 15px; background-color: #fccfaa">

However, and there is always one..., Mozilla has other names for the feature than those in the official spec. Mozilla uses -moz-border-radius-topleft as opposed to -webkit-border-radius-top-left

Note that the corner commands are duplicated in the example above as Mozilla has a unique take on the command, see right:

 

The four corners can also be rendered individually to create some impressive, though simple, styling.

Mozilla/Firefox and Safari 3 users should see a box with a rounded left upper corner.

Mozilla/Firefox and Safari 3 users should see a box with a rounded right upper corner.

Mozilla/Firefox and Safari 3 users should see a box with a rounded left lower corner.

Mozilla/Firefox and Safari 3 users should see a box with a rounded right lower corner.

 

Please note the Mozilla version has no hyphen between specific corner locations (topleft) and the Webkit commands require a hyphen (top-left). Thanks go to Andrew for pointing this out, as I had committed the grievous typo error myself...

Commands for mozilla/ Official CSS3 commands

  • -moz-border-radius-topleft / -webkit-border-top-left-radius
  • -moz-border-radius-topright / -webkit-border-top-right-radius
  • -moz-border-radius-bottomleft / -webkit-border-bottom-left-radius
  • -moz-border-radius-bottomright / -webkit-border-bottom-right-radius

I hope you will have fun with this new feature set, so much cleaner and simpler than the cumbersome methods of the past :0)

I will be adding some CSS driven menu tutorials making use of these features in future articles, so please check back for updates.


Babs Rudlin
Written on Monday, 02 November 2009 00:00 by Babs Rudlin

Viewed 971 times so far.
Like this? Tweet it to your followers!
blog comments powered by Disqus

Search the Site...

Advertising