简体   繁体   中英

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

我相信jQuery corner确实可以满足您的需求。

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM