3

There're border-radius property to round box corners. But how to round corners inside block, like subtracting circle?

Like here: http://malsup.com/jquery/corner/

Curl settings

Artem E
  • 369
  • 1
  • 4
  • 19
  • 1
    I'm not sure what you mean by "inside block" and "subtracting circle". Here is an example using `border-radius` to style a `div` to look like a circle: http://jsfiddle.net/39N9V/ – showdev Aug 29 '13 at 18:16
  • 2
    @showdev: He means he wants the corners to curve inwards, instead of outwards. Think a negative border-radius, only I doubt anything like that exists. – Madara's Ghost Aug 29 '13 at 18:19
  • No there's no such thing in CSS, however if you show us what are you trying to achieve we can find other ways to do this. – Yotam Omer Aug 29 '13 at 18:20
  • @MadaraUchiha, yes. you are right. But negative border-radius does not work. – Artem E Aug 29 '13 at 18:21
  • 1
    Its not overly browser supported, you could use a PNG background image however to create the effect. Which in my view would be easier and more browser compatible. – Sir Aug 29 '13 at 18:22
  • @YotamOmer, I edited question. Sorry for this.. – Artem E Aug 29 '13 at 18:23
  • 1
    This might be helpful: http://stackoverflow.com/questions/11033615/inset-border-radius-with-css3 An example: http://jsfiddle.net/39N9V/1/ – showdev Aug 29 '13 at 18:25
  • @showdev, why not writing this in answer box? Anyway, thanks! – Artem E Aug 29 '13 at 18:28

3 Answers3

7

This can be done by adding four circular "gradient" background images on top of the normal background image, each positioned at the appropriate corner. There's an example on Lea Verou's blog. From that I've extracted a JSFiddle; the key code is

.round {
    background:
        radial-gradient(circle at 0 100%, rgba(204,0,0,0) 14px, #c00 15px),
        radial-gradient(circle at 100% 100%, rgba(204,0,0,0) 14px, #c00 15px),
        radial-gradient(circle at 100% 0, rgba(204,0,0,0) 14px, #c00 15px),
        radial-gradient(circle at 0 0, rgba(204,0,0,0) 14px, #c00 15px);

    background-position: bottom left, bottom right, top right, top left;
    background-size: 50% 50%;
    background-repeat: no-repeat;

    padding: 14px;
}
Domenic
  • 110,262
  • 41
  • 219
  • 271
1

No, there isn't a way to do it with pure CSS as far as I know. It's not even simple to do it with JavaScript or jQuery.

As far as I know, the jQuery plugin you linked is the one that works best for you, especially since you want a cross-browser solution, which advanced CSS3 isn't there yet, and it is the one you should use.

Madara's Ghost
  • 172,118
  • 50
  • 264
  • 308
1

There is one way to do it with pure CSS:

CSS code:

div {
height: 200px;
background: red;
position: relative;
width:200px;
}

div:after {
content: '';
position: absolute;
top: -20px; right: -20px;
border-top: 50px solid white;
border-left: 50px solid white;
width: 0;
background:#fff;
    border-radius:100px;

}
div:before {
content: '';
position: absolute;
top: -20px; left: -20px;
border-top: 50px solid white;
border-left: 50px solid white;
width: 0;
background:#fff;
    border-radius:100px;

}

HTML: <div></div>

Here is an example:

Rijul
  • 515
  • 7
  • 19