1

Hi I'm trying to make a Pomodoro clock. I've made a play button by removing border-right and increasing border-left width to create a triangle.

My questions is - how do I apply border-radius to it?

https://codepen.io/jenlky/pen/ypQjPa?editors=1100

  <div id="all-buttons" class="buttons">
    <!-- play button -->
    <div id="play" class="play-button"></div>
    <!-- pause button -->
    <div id="pause">
      <div class="line-1"></div>
      <div class="line-2"></div>
    </div>
  <!-- end of play and pause button-->
  </div> 

.play-button {
    z-index: 2;
    width: 48px;
    height: 48px;
    border-style: solid;
    border-width: 24px 0px 24px 48px;
    border-color: white white white #FF8F83;
}

play button

jenlky
  • 396
  • 5
  • 22
  • 1
    https://stackoverflow.com/questions/14446677/how-to-make-3-corner-rounded-triangle-in-css – Pete Jan 18 '18 at 13:01
  • 1
    Make 2 triangles like [this](https://stackoverflow.com/a/9450768/5393271) – sTx Jan 18 '18 at 13:12
  • You can't expect to just give correct code, so here's some help on how to accomplish this : https://css-tricks.com/snippets/css/css-triangle/ – Arne Banck Jan 18 '18 at 13:36
  • How about this example: [codepen](https://codepen.io/GrannyWithA50Cal/pen/GywBjM?editors=1100) – Granny Jan 18 '18 at 13:43
  • Possible duplicate of [How to make 3-corner-rounded triangle in CSS](https://stackoverflow.com/questions/14446677/how-to-make-3-corner-rounded-triangle-in-css) – StudioTime Jan 18 '18 at 13:46

2 Answers2

0

HTML play button:

.circle_inner{
    position: relative;
    height: 100%;
}
.circle_inner:before{
    content: "";
    display: block;
    width: 0;
    height: 0;
    border-style: solid;
    border-width: 10px 0 10px 20px;
    border-color: transparent transparent transparent #000;
    position: absolute;
    top: 50px;
    left: 50%;
    margin: -10px 0 0 -7px;
}
        <div class="circle_inner">
            
        </div>
Ylama
  • 2,449
  • 2
  • 25
  • 50
  • This is similar to the play button I made, but I can't apply border-radius to it.... therefore I'm looking for alternate solutions – jenlky Jan 18 '18 at 13:06
0

Try this (Less)

<div class="control play">
  <span class="left"></span><span class="right"></span>
</div>

.control {
  @color: #ffb160;
  @highlight: darken(@color, 10%);
  @duration: 0.4s;
  @sin:  0.866;
  @size: 112px;

  border-radius: 50%;
  margin: 20px;
  padding: @size*0.25;
  width: @size;
  height: @size;
  font-size: 0;
  white-space: nowrap;
  text-align: center;
  cursor: pointer;

  &, .left, .right, &:before {
    display: inline-block;
    vertical-align: middle;
    transition: border @duration, width @duration, height @duration, margin @duration;
    transition-tiomig-function: cubic-bezier(1, 0, 0, 1);
  }

  &:before {
    content: "";
    height: @size;
  }

  &.pause {
    .left, .right {
      margin: 0;
      border-left: @size*0.33 solid @color;
      border-top: 0 solid transparent;
      border-bottom: 0 solid transparent;
      height: @size*@sin;
    } 

    .left {
      border-right: @size*0.2 solid transparent;
    }
  }

  &.play {
    @border: @size/4;

    .left {
      margin-left: @size/6;
      border-left: @size*@sin/2 solid @color;
      border-top: @border solid transparent;
      border-bottom: @border solid transparent;
      border-right: 0px solid transparent;
      height: @size - 2*@border;
    } 

    .right {
      margin: 0;
      border-left: @size*@sin/2 solid @color;
      border-top: @border solid transparent;
      border-bottom: @border solid transparent;
      height: 0px;
    }
  }

  &:hover {
    border-color: @highlight;

    .left, .right {
      border-left-color: @highlight;
    }
  }
}
Alexandr
  • 95
  • 8