Creating rounded corners with CSS
It wasn't too long ago when the only real way to get nice, rounded corners onto a webpage was through the use of images. This is ridiculous if you think about it because it should be very easy for a browser to render rounded corners itself. Today, all good browsers come with a built-in ability to control the look and feel of corners.
Before we begin its worth noting that good web design avoids making use of tables (unless you are actually presenting a table) and instead uses the far more powerful and dynamic <div> tags. If you want to follow along here, make sure your HTML is DIV based first.
Let's start by looking at a standard CSS class that specifies a thin border, some padding and a shaded background:
border: 1px solid #888;
background: #bbb;
}
This class, wrapped around some text look like this:
But, let's say that we wanted to give it a bit of flair. If the user hovers over the "button", the background changes color and the border becomes rounded at the top right corner. To accomplish this, we use the following CSS:
background: #e7e7e7;
-moz-border-radius-topright: 7px;
-webkit-border-top-right-radius: 7px;
}
Now, if you hover over the button, you should notice the change in background color accompanied by the rounded corner, like so:
Of course, its just as easy to make all the corners of a div rounded in one go by dropping the location specifications (i.e. topright) from the declarations. In which case, a purely rounded div would have a class declaration like this:
border: 1px solid #888;
background: #e7e7e7;
-moz-border-radius: 7px;
-webkit-border-radius: 7px;
}
and would look like this as a result:
That's how easy it is. Remember that in order to make use of this, your website needs to be based on good underlying HTML development. Many older or poor quality websites use tables for layout instead of <div> tags. If this is the case, consider upgrading or moving to a quality platform such as Drupal or a Site prebuilder distribution.
You are online with David Mercer
"Bestselling author of books about the web, eCommerce and marketing." Wikipedia
Inspiring and empowering entrepreneurs, businesses, bloggers and startups through social, marketing, and business advice.
30 000+ readers and counting
"This made my day" - Guy Kawasaki
Author of Enchantment and The Art of the Start
Sponsor this webpage for cents a day
- Real SEO backlinks
- Premium page position
- Large ad space
- Displays every hit
- Targeted audience
- High conversions
Become a recognized visionary
Share your insights into the future of your niche. Gain a following and drive brand recognition, traffic and sales.
Social SEO website reviews
Add your site to the world's premiere web directory and bookmarking service. With social integration and SEO juice to deliver multiple backlinks & great ROI.
Boost book & product sales
Track, analyze and promote any book or product sold through Amazon, anywhere in the world from around 3c per day.
topulo.us predictions
- Social influence will overtake web traffic as the primary metric for advertisers and marketers
- "Steve jobs" by Walter isaacson will sell more than 200 000 copies in 2012 on Amazon.com alone.
- Apple's iPad will sink below 50% market share by mid 2013
- Google search plus your world will kill off Twitter within two years
- Cloud printing with cloud ready printers will kill off the fax machine
TopRank
- Online Marketing News: Facebook IPO, Harmonize with Google+, Pinterest Dominates Traffic
- Essential Shifts in Online Marketing: Are You On Board? Are You Optimized?
- Blogger Relations: Push or Pull? How to Get Bloggers to Mention Your Brand
- Getting Your Internet Marketing Dream Job: How to Interview & Succeed at a Top Agency
- Google+ Optimization vs. Community Building: Pros & Cons of Google SPYW
terms of use | privacy | about | write for us | affiliates | employment | partner with us | advertise | contact
© site prebuilder 2009






















