开发者

round corners question

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


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;
}


I believe jQuery corner does exactly what you need.


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.


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.


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.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜