colorpress - Premium WordPress Theme
$49.99

ColorPress is a theme that lets you play with color! Now, you will not be restricted to using a few color schemes provided by the developer. You have all the colors to apply to your theme! Just pick your color and magic happens. The theme comes with a configurable slideshow, 3 blog layouts, dropdown menus and a load of other options that will rock your socks!

Wix.com

May
10

Nifty Rounded Edges Using Only CSS

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. :)

This post was viewed 15,694 times

» 31 people left comments { Collapse all | Expand all }

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

    Reply to this comment
  2. so cute the method

    Reply to this comment
  3. 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
  4. 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
  5. 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
  6. VirtualOdin buzzed on May 15th, 2008 | 12:44 am

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

    Reply to this comment
  7. Very good, thanks :)

    Reply to this comment
« 4 3 2 1 »

    3 Trackback(s)

  1. May 17, 2008: Bilgi Foto?raf Resim Güncel Meseleler » Blog Archive » Seçme Blog Yaz?lar? – 2
  2. May 13, 2008: AK47 » links for 2008-05-14
  3. May 12, 2008: CSS Guides and A Free PS3 « twodayslate

» Leave a Comment!

Search :
Browse :
Archive :

$$$ Make Money $$$

Become an Affiliate

Welcome to Blog Oh! Blog's affiliate program! I personally invite you to make money by selling all of Blog Oh! Blog's Premium themes.

You will get a whopping 25% share on each sale generated through your affiliate link.

All you need to do is sign up as Blog Oh! Blog's affiliate, choose a banner, paste it on your website or blog and wait for sales to happen. It's as simple as that!

All affiliates will be paid on 10th of every month. Your affiliate earning needs to be a minimum $50 to get paid for each month.

Here is the sign up link and here are some banners to get you started!