I’ve a div using css 3,i’m placing a circle but when i place objects,it is going out of circle because div is still there and it is rectangle.
Can i use some thing instead of div and make circle.My objective is i need a circle ,when i place objects ,it should not move out of circle.
Thanks
There’s no actual way of making an element circular. You can make it look circular using the well-known
border-radius‘trick’.To create the effect that the the text/contents of the
divare only inside the borders of the circle, you can make sure it’s filled within the largest square contained in the circle, usingpadding. Here’s a visual illustration:Here’s a demo: little link.
HTML:
CSS:
Edit: for images, you have two cases:
You want the
divto have a circular background. In this case, use thebackground-clip: padding-box;property (you need vendor-prefixed versions for this to work). Here’s a demo: little link.You have an
imgtag inside yourdiv— you can use the prior method.