PreviousPauseNext
Latest Free WordPress Themes | More Free Themes
Digital Statement WordPress Theme
Digital Statement

Post Slideshow
Content Tabs
Widgetized
Twitter Ready
Flickr Ready

Demo
Download
Latest Free WordPress Themes | More Free Themes
Angel WordPress Theme
Angel

Light Colored
Valid CSS/XHTML
Widgetized
Unique Layout
Styled Comments
DOM Tabs

Demo
Download
Latest Free WordPress Themes | More Free Themes
Portfolio WordPress Theme
Portfolio Press

Dark Colored
Valid CSS/XHTML
Widgetized
Unique Layout
Styled Comments
Neat Code

Demo
Download
Latest Free WordPress Themes | More Free Themes
DailyPress WordPress Theme
DailyPress

Minimalistic Theme
125x125 Ad Space
Widgets Ready
Social Tagging
Tabbed Sidebar
XHTML Compliant

Demo
Download
Latest Free WordPress Themes | More Free Themes
Firebug WordPress Theme
Firebug

Colorful Theme
125x125 Ad Space
Widgets Ready
Social Tagging
Gravatar Ready
XHTML Compliant

Demo
Download
Latest Free WordPress Themes | More Free Themes
Gridblog WordPress Theme
Gridblog

Minimalistic Design
WP Gallery Ready
Gravatar Ready
Grid Based
Widget Ready
XHTML Compliant

Demo
Download
Latest Free WordPress Themes | More Free Themes
Blue Weed WordPress Theme
Blue Weed

WP 2.5 Gallery Compatible
Adsense Ready
Gravatar Ready
3-Columns
Widget Ready
Logo PSD

Demo
Download
Latest Free WordPress Themes | More Free Themes
AdsPress WordPress Theme
AdsPress

WP 2.5 Gallery Compatible
Adsense Ready
Gravatar Ready
2-Columns
Widget-Ready
Logo PSD

Demo
Download
Latest Free WordPress Themes | More Free Themes
Statement WordPress Theme
Statement

WP 2.5 Gallery Compatible
Quick Tabs
100% Width
3-Columns
Widget-Ready
Logo PSD

Demo
Download
Latest Free WordPress Themes | More Free Themes
Tutorials WordPress Theme
Tutorial Theme

Tutorials Feature
Thumbnails
Bright colors
3-Columns
Widget-Ready
XHTML Compliant

Demo
Download

Nifty Rounded Edges Using Only CSS

Written by Jai on May 10, 2008 – 1:25 pm - 9,145 views

If you have a Google Analytics account, you must have seen that Google uses slightly rounded edges in the menu buttons on the left. See the picture below :-

CSS Rounded Tips

Today, I will teach you how to give these nifty little rounded edges to your menu. Given below is the CSS code. This goes into the head section of your HTML file. :-

CSS

<style>
ul {
width:180px;
list-style-type:none;
margin:0 auto;
padding:0;
}

li a {
display:block;
position:relative;
border-width:1px 0;
border-color:#ccc;
border-style:solid;
color:#555;
text-decoration:none;
margin:4px 1px;
}

li a span {
display:block;
position:relative;
margin:0 -1px;
border-width:0 1px;
border-color:#ccc;
border-style:solid;
background-color:#eee;
padding:2px 6px;
}

li a:hover {
border-color:#aaa;
color:#333;
}

li a:hover span {
border-color:#aaa;
background-color:#ddd;
}
</style>

Here is the HTML needed. This goes in the body of your HTML file. :-

HTML

<ul>
<li>
Home
About
Products
Services
Contact
</li>
</ul>

Once you have copied the above pieces of code into your HTML file and when you run it, you should see something like this :-

rounded edges

So, you can see that these rounded corners can be created without using any kind of images. You can download the source file here :- Download

Please let me know if you have any problems or just leave comments if you like it. :)

If you enjoyed this post, make sure you subscribe to my RSS feed!


28 Responses to “Nifty Rounded Edges Using Only CSS”

  1. Sweet&8212;thanks Jai.

    My current theme uses these nifty CSS corners, but I’m not fancy on the precisely how they’re implemented.

    I’ve been planning on cleaning up the code, for reuse in other places, and you’ve just made my job easier.

    Thanks again.


    Reply to this comment

  2. You can also use this:

    -moz-border-radius: 20px;
    -khtml-border-radius: 20px;
    -webkit-border-radius: 20px;
    border-radius: 20px;


    Reply to this comment

  3. This is awesome. Thank you!


    Reply to this comment

  4. Thank you. This is great! It has made life a lot easier.


    Reply to this comment

  5. Thanks jai. Another knowledge gained. :)


    Reply to this comment

  6. You are too much Jai. You giving us free lesson. LOL.
    Thank you thank you. :D


    Reply to this comment

  7. Thanks for the good tips! Previously your tips for changing header images is good and simpe. I help my friend to setup his anime blog’s header images. :D


    Reply to this comment

  8. Great Job Jai
    This is a pretty amazing blog…


    Reply to this comment

  9. Very good, thanks :)


    Reply to this comment

  10. These nifty corners are nifty alright, but my curiousity has the better of me. Can you explain “how” they work…


    Reply to this comment

  11. great tip, caught me off-guard :)

    however i made a few changes that produce semantically more sensible code i think. only problem is that unlike firefox and opera, ie doesn’t support :hover on li and thus the horizontal borders do not get darkened.

    Home
    About
    Products
    Services
    Contact


    Reply to this comment

  12. ah… no html comments allowed. once sec…

    <html>
    <head>
    <style>
    <!–

    ul {
    width:180px;
    list-style-type:none;
    margin:0 auto;
    padding:0;
    }

    li {
    display:block;
    position:relative;
    border-width:1px 0;
    border-color:#ccc;
    border-style:solid;
    margin:4px 1px;
    }

    li a {
    display:block;
    position:relative;
    margin:0 -1px;
    border-width:0 1px;
    border-color:#ccc;
    border-style:solid;
    background-color:#eee;
    padding:2px 6px;
    color:#555;
    text-decoration:none;
    }

    li:hover {
    border-color:#aaa;
    }

    li a:hover {
    border-color:#aaa;
    color:#333;
    background-color:#ddd;
    }

    //–>
    </style>
    </head>
    <body>
    <ul>
    <li><a href="#">Home</a></li>
    <li><a href="#">About</a></li>
    <li><a href="#">Products</a></li>
    <li><a href="#">Services</a></li>
    <li><a href="#">Contact</a></li>
    </ul>
    </body>
    </html>


    Reply to this comment

  13. i am not much of a graphic artist and i hate doing graphics…i am more of a programmer but this certainly is nice piece of CSS and would be very helpful when it comes to tweaking a theme or two…thanks man….made stuff a little lucid!

    Cheers!!


    Reply to this comment

  14. so cute the method


    Reply to this comment

  15. Cool! Thanks for the info. I’ll bug my husband to implement this for me.


    Reply to this comment

  16. Awesome! That is a nifty trick!


    Reply to this comment

  17. Thank you so much for sharing this interesting CSS styling. I’ve never knew that the Google designers have opted for pure CSS instead of images for the rounded corner design. The 1px indentation at all four corners is an interesting way to trick the human eye into thinking that it’s a rounded corner :) amazing!

    Anyway I’ve been looking through the source code of GMail as well the other day, and realised that they’re using a single circle (instead of four separate images) for all four rounded corners of the content container. Now that’s another interesting thing!


    Reply to this comment

  18. awesome css tips! thanks for sharing.


    Reply to this comment

  19. Very nice blog. Really this article very interesting.
    i like this.


    Reply to this comment

  20. CSS “Cascading Style Sheets” Lessons
    css list style Properties and examples — http://css-lessons.ucoz.com/list-css-examples.htm


    Reply to this comment

  21. No disrespect but please check your code before posting. It does not work as is. It does not contain hyperlink tags (a href) and also does not work in IE 7 or FF 3. Too many things missing, please test before posting bro.


    Reply to this comment

  22. Hello, here is another site, no images 1px 3px or no borders.


    Reply to this comment

  1. 6 Trackback(s)

  2. jaehong75.com : links for 2008-05-11
  3. ??????????? ?????? ????????? ?? CSS. | MishaSite.net
  4. CSS Guides and A Free PS3 « twodayslate
  5. AK47 » links for 2008-05-14
  6. Bilgi Foto?raf Resim Güncel Meseleler » Blog Archive » Seçme Blog Yaz?lar? – 2
  7. Do I read your Blog?

Post a Comment