Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

chopped-off corners from a button with a solid border

Tags:

css

button

border

I want to cut two corners of a button with a 3px solid border and no background, like the example below, preferably with only CSS. I tried many options and searched the web, but no luck so far... Do you guys know a way to achieve this? Thanks for any response!

button with cut-corner border

What I got so far is:

a.button{
    padding: 10px 18px;
    border: 3px solid $blue;
    text-transform: uppercase;
    font-size: 15px;
    border-top-left-radius: 15px;
    border-bottom-right-radius: 15px;
}

The problem is that this results in a radius corner, and I want the corners to be a straight cut.

like image 843
arvanderkamp Avatar asked Oct 26 '25 03:10

arvanderkamp


1 Answers

This should help you get started.

You can refine it according to your needs.

.button {
  display: inline-block;
  text-transform: uppercase;
  text-decoration: none;
  padding: 10px 20px;
  border: 3px solid #3777BC;
  margin: 20px;
  position: relative;
  color: #3777BC;
  letter-spacing: 1px;
}
.button:before {
  content: '';
  width: 20px;
  height: 20px;
  background: #fff;
  border: 3px solid #3777BC;
  transform: rotate(45deg);
  position: absolute;
  border-top: 0;
  border-left: 0;
  border-bottom: 0;
  top: -12px;
  left: -13px;
}
.button:after {
  content: '';
  width: 20px;
  height: 20px;
  background: #fff;
  border: 3px solid #3777BC;
  transform: rotate(-132deg);
  position: absolute;
  border-top: 0;
  border-left: 0;
  border-bottom: 0;
  top: auto;
  right: -13px;
  bottom: -12px;
}
<a href="#" class="button">Newsletter Signup</a>
like image 132
Aslam Avatar answered Oct 28 '25 17:10

Aslam



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!