I'm attempting to design a CSS triangular button that is positioned in the top left corner of a div
using Bootstrap 4.
Here's my concept as crafted with Photoshop:
https://i.sstatic.net/cbUWL.png
However, after numerous attempts, this is the closest I've come to achieving it:
https://i.sstatic.net/RkKnd.png
I want to style it so that the button can adapt its colors based on one of the btn-*style*
classes, allowing for versatility in color selection.
Any suggestions?
Below is the triangle CSS code snippet:
.triangle-up-left {
float : left;
width : 0;
height : 0;
margin : 0;
padding-bottom : 10%;
padding-left : 10%;
overflow : hidden;
text-align : center;
}
.triangle-up-left:after {
content : "";
display : block;
width : 0;
height : 0;
margin-left : -500px;
border-bottom : 500px solid transparent;
border-left-width : 500px;
border-left-style : solid;
}
And here is the current div
layout I am utilizing:
<div class="row border rounded p-2 mx-2 mt-3 shadow-sm">
<a href="#" role="button" class="btn btn-warning triangle-up-left"><i class="far fa-star"></i></a>
<div class="d-none d-sm-none d-md-block col-md-1 p-0 m-0 mx-sm-auto">
<img src="...image.."" alt="Image" class="img-fluid rounded-circle m-3"></a>
</div>
<div class="col-md-9 pl-sm-0 pl-md-5 m-0 ">
some text
</div>
<div class="col-sm-1 col-md-2 p-0 pt-4 m-0 text-center ">
Some text
</div>
</div>