I want to make a shape in html that has cutoff corners and with a borderline around the shape.
I can make cut-off shapes without a border like so:
html:
<div class="cut-off"></div>
css:
.cut-off{
position:relative;
top:400px;
left:400px;
height:155px;
width:200px;
background:red;
}
.cut-off:after{
position:absolute;
bottom:0px; right:-20px;
content:".";
text-indent:-999px; overflow:hidden;
display:block;
width:0px; height:0px;
border-top: 20px solid green;
border-right: 20px solid transparent;
}
.cut-off:before{
position:absolute;
top:0; right:-20px;
content:"#";
text-indent:-999px; overflow:hidden;
display:block;
background:blue;
width:20px; height:135px;
}
Jfiddle here
Now i want a border that goes around the shape. How should i do that?
I want a shape that is something like this:
Filled with a color.
Style the cut corner with the ::before pseudo-element and use the content property required while using the :: before pseudo-element to generate and insert content. Set the position to "absolute" and add the top and right, border-top and border-right properties.
By altering your html structure a little bit, I could make this
<div class="cut-off"></div>
<div class="cut-off2"></div>
.cut-off{
position: relative;
width: 300px;
height: 150px;
border-bottom: 80px red solid;
border-right: 80px transparent solid;
}
.cut-off2{
position: absolute;
z-index: -1;
top:0;
left: 0;
width: 305px;
height: 150px;
border-bottom: 82px blue solid;
border-right: 80px transparent solid;
}
p{
position: absolute;
left: 0;
bottom:-40px;
}
Basically it adds another div under the existing one. For the cuttof effect it plays with border dimensions.
EDIT: I also provided a way of including content in the area.
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