Home arrow Style Sheets arrow Page 3 - Building Rounded Corners with CSS3`s -webkit-border-radius Property
STYLE SHEETS

Building Rounded Corners with CSS3`s -webkit-border-radius Property


In this penultimate part of the series I demonstrate how to build an engaging rounded corner effect on WebKit-based browsers via the custom “-webkit-border-radius” property. The entire styling process is very simple, so you shouldn’t have major problems implementing it within your own web pages.

Author Info:
By: Alejandro Gervasio
Rating: 5 stars5 stars5 stars5 stars5 stars / 1
March 19, 2010
TABLE OF CONTENTS:
  1. · Building Rounded Corners with CSS3`s -webkit-border-radius Property
  2. · Review: the custom -moz-border-radius property
  3. · Introducing the -webkit-border-radius property
  4. · Including the previous CSS styles in a web page

print this article
SEARCH DEVARTICLES

TOOLS YOU CAN USE

advertisement
Building Rounded Corners with CSS3`s -webkit-border-radius Property - Introducing the -webkit-border-radius property
(Page 3 of 4 )

To be frank, building rounded corners on WebKit-based browsers is very similar to performing the same task on browsers using the Mozilla rendering engine, with one subtle difference: in this case, to get the effect properly displayed on screen, it’s necessary to use the “-webkit-border-radius” property. For obvious reasons, this is pretty annoying, but it’s worth it to set up an example that shows how to create the effect, at least for demonstration purposes.

Having clarified that point, please pay attention to the following CSS fragment, which gives an HTML container a “rounded” touch through the pertinent “-webkit-border-radius” property:

<style type="text/css">

body {

    padding: 0;

    margin: 0;

    background: #fff;

    font: 1em Arial, Helvetica, sans-serif;

    color: #000;

}

#wrapper {

    width: 960px;

    margin: 0 auto;

}

#header, #content, #footer {

    padding: 30px;

}

.rounded_container {

    width: 400px;

    padding: 20px;

    background-color: #39f;

    -webkit-border-radius: 2em;

}

</style>

Definitely, that wasn’t rocket science, right? As you can see, using the “-webkit-border-radius” property is nearly identical to working with its counterpart “-moz-border-radius,” so it’s not worthwhile to waste your time (and mine) explaining how the previous CSS snippet does its thing. To get the rounded corner effect up and running, however, it’s necessary to include the earlier set of styles in a web page.

That’s exactly what I’ll be doing in the last section of this tutorial, so go ahead and read the lines to come. We’re almost done taming those wild corners!


blog comments powered by Disqus
STYLE SHEETS ARTICLES

- CSS Combinators: Working with Child Combinat...
- CSS Combinators: Using General Siblings
- Intro to CSS Combinators
- CSS Semicircles and Web Page Headers
- Drawing Circular Shapes with CSS3 and Border...
- More CSS Pagination Link Templates
- CSS Pagination Links
- Animated CSS3 Image Gallery: Advanced Transi...
- CSS3 Animated Image Gallery: Transitions
- CSS3 Properties: Fixed Heights with box-sizi...
- CSS3 Properties: Altering Strokes and 3D Eff...
- CSS3 Properties: Text-Stroke
- CSS3 Transitions: Width and Height Properties
- Creating a Drop Down Menu in CSS3
- Intro to CSS Transitions

Dev Articles Forums 
 RSS  Articles
 RSS  Forums
 RSS  All Feeds
Weekly Newsletter
 
Developer Updates  
Free Website Content 
Contact Us 
Site Map 
Privacy Policy 
Support 



© 2003-2012 by Developer Shed. All rights reserved. DS Cluster 8 - Follow our Sitemap
Popular Web Development Topics
All Web Development Tutorials