I have a rectangle where each side of the diagonal has it's own color
div {
width: 0;
height: 0;
border-left: 150px solid green;
border-top: 100px solid gray;
}
Now I wanted to add a border-radius to the div, but then I noticed that this works fine for all sides except for bottom left.
So if I add:
border-radius: 10px 10px 10px 0;
I get this:
.. but as soon as I add a bottom left border-radius, I get this:
1) Why does this happen?
2) Is there an easy fix?
Edit:
I'm using Chrome, but I just looked a firefox and IE and the results are different!
Firefox:
IE 11
What's going on?
CSS Syntaxborder-radius: 1-4 length|% / 1-4 length|%|initial|inherit; Note: The four values for each radius are given in the order top-left, top-right, bottom-right, bottom-left. If bottom-left is omitted it is the same as top-right. If bottom-right is omitted it is the same as top-left.
You can use position: absolute on triangle element and set top and right properties to 0. You can also just use pseudo-element with absolute position for triangle.
The outline-radius property is used to specify the radius of an outline. It is used to give rounded corners to outlines.
Try to add a wrapping container:
<div class="wrap">
<div class="triangle"></div>
</div>
with this style:
.wrap {
display: inline-block;
overflow: hidden;
border-radius: 10px;
}
overflow: hidden;
should do the trick.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With