I'm struggling to replicate the button style as in the image below. I've tried using clip path but I'm not getting the desired effect where there is a visible border and a semitransparent background.
Is there a simple workaround for this?
I'm struggling to replicate the button style as in the image below. I've tried using clip path but I'm not getting the desired effect where there is a visible border and a semitransparent background.
Is there a simple workaround for this?
On
To achieve an exact copy of this image the background needs to be an svg image.
however if your background is solid you can do the trick with just css like this
button {
background-color: #bb000077;
border: 2px solid #ff6666;
font-weight: bold;
color: #fff;
font-size: 20px;
padding: 15px 25px;
position: relative;
outline: none;
}
button::before,
button::after {
content: '';
pointer-events: none;
position: absolute;
width: 29px;
height: 29px;
background-color: #fff;
transform: rotate(45deg);
}
button::after {
top: -16px;
right: -16px;
border-bottom: 2px solid #ff6666;
}
button::before {
bottom: -16px;
left: -16px;
border-top: 2px solid #ff6666;
}
<button>Start my free session</button
Your idea to use
clip-pathshould work out. Here's an approachThe only issue with this solution is the support for
clip-pathhttps://caniuse.com/?search=clip-pathHere's a codepen https://codepen.io/Hornebom/pen/912d2557034ba9c3936a06ced8584de4