0

I am trying to round the top & bottom edges of this polygon to be the same as the icon. Does somebody know what I am doing wrong?

.activity {
  max-width: 200px;
}
.activity__icon {
  border-right-radius: 50%;
  text-align: center;
  background-color: #eee;
  clip-path: polygon(50% 20%, 100% 50%, 50% 80%, 0% 50%);
  margin: 0 auto;
  padding: 2rem;
}
.activity__icon i {
  color: #707070;
  border: 2px solid #707070;
  border-radius: 50%;
  max-width: fit-content;
  padding: 15px;
  font-size: 25px;
  text-align: center;
  vertical-align: middle;
}
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/5.15.1/css/all.min.css">
<div class="activity"> 
<div class="activity__icon">
<i class="fas fa-play-circle"></i>
</div>

https://codepen.io/avashavash/pen/OJRPJNL

1
  • Polygons do not have curves. You need to use a path Commented Nov 28, 2020 at 8:01

1 Answer 1

0

You cannot round polygon so here is a different idea using transformation:

.activity {
  width: 200px;
}

.activity__icon {
  text-align: center;
  margin: 0 auto;
  padding: 2rem;
  position:relative;
  z-index:0;
}
.activity__icon::before {
  content:"";
  position:absolute;
  z-index:-1;
  width:141px;  /* 200px / sqrt(2) */
  height:141px; /* 200px / sqrt(2) */
  left:50%;
  top:50%;
  background-color: #eee;
  transform:translate(-50%,-50%) rotate(45deg) rotate3d(1,-1,0,65deg);
  border-radius: 28px 0 20px 0;
}

.activity__icon i {
  color: #707070;
  border: 2px solid #707070;
  border-radius: 50%;
  padding: 15px;
  font-size: 25px;
  text-align: center;
  vertical-align: middle;
}
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/5.15.1/css/all.min.css">
<div class="activity">
  <div class="activity__icon"><i class="fas fa-play-circle"></i>
  </div>

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.