Reputation: 22948
does anyone know how to round corners of div using javascript, but round only lets say 1 or 2 corners which you can choose not all of them. Thank you
Upvotes: 0
Views: 302
Reputation: 72510
Do you need full cross-browser support? Why not keep it as an "enhancement" for better browsers and use CSS:
.corners {
border-radius: 8px;
-moz-border-radius: 8px;
-webkit-border-radius: 8px;
}
Upvotes: 3
Reputation: 15765
You can use CSS border-radius to achieve that effect. For browsers that don't support it (Internet Explorer), DD_roundies is a nice script.
Upvotes: 1
Reputation: 3757
I have seen frameworks that round divs using four images placed atop the corners of the div using background styles or a table or floating divs or (pick your favorite - I prefer background styles). You would choose to use fewer than all four "corner" images.
Essentially what happens is you wrap an inner div - which does not have borders - with an outer div that has a border AND the rounded corner images placed strategically. Your content goes in the inner div.
As the others suggest, several frameworks provide this functionality out of the box. Regardless, you will need the rounded corner images.
Upvotes: 0
Reputation: 103135
Do you particularly need to create this on your own? There are several libraries out there to do this for you. FOr example there is this jQuery plugin.
Upvotes: 1