views:

42

answers:

2

Can someone help me understand a way of adding rounded corners top left and top right of the current page link below? I have used jQuery corners but this doesnt work in IE very well... I was looking to use PNG. The space between the corners should be white. The PNG would be transparent letting whatever image was below to show through.

<ul>
    <li class="current"><a href="#"><span>Home</span></a></li>
    <li><a href="#"><span>Create Account</span></a></li>
    <li><a href="#"><span>Order a Catalogue</span></a></li>
    <li><a href="#"><span>Distributors</span></a></li>
    <li><a href="#"><span>About Us</span></a></li>
    <li><a href="#"><span>Contact Us</span></a></li>
    <li><a href="#"><span>Login</span></a></li>
</ul>

Any help would be greatly appreciated.

A: 

Draw your rounded rectangle in something like Paint.NET (make sure you have a transparent background!) and make it the exact width of the LI. Give it more than enough height so that you can cut off the button rounded corners and it will still be tall enough to fill the LI. Cut off the bottom rounded corners, crop accordingly, and save it as a PNG. Set it as a background image on the element with CSS...

ul li.current {
  background:url(../images/nav-current.png) no-repeat;
}

Note: if you use a background color on the LI, it will bleed through the transparent part of the rounded corners, which is not good.

Moving forward... you can just use the CSS3 border-top-left-radius and border-top-right-radius along with background-color (no images!), but these are not supported in IE8 and older.

Josh Stodola
I forgot to mention the menu items need to expand
Andy
@Andy If I am understanding what you mean by "expand", you can just make the image tall enough and that will be no problem. Background images can be bigger than their container and it will not cause an overflow.
Josh Stodola
Its the width im thinking about, if its not a set width you can't use a fixed image.
Andy
@Andy Uhhhh, that's why I asked you that in the comment to the question!!!
Josh Stodola
@Andy You said the list has a fixed width.
Josh Stodola
Sorry i meant the UL was a fixed, with varying li. Sorry!
Andy
A: 

Hey friend to apply border radius that works in IE also you have to apply border-radius.htc file and you can apply it to your CSS like this one. In my project i am using it on Div tag but you can use it whereever you want.

div
{
-moz-border-radius: 10px;
background: #D4D0C8;
border: 1px solid #808080;
-webkit-border-radius:10px;
behavior:url(border-radius.htc);
}

you will find border-radius.htc file on google also. If you can provide your emailid then i can mail it to you if you want

mehul9595
That's cool mate, does it work in all browsers?
Andy
Is the border-radius path relative to the css file or html file?
Andy
Andy, Yes i have tested it in IE, Chrome and Firefox it works very well. border-radius file is related to CSS file.
mehul9595