【问题标题】:Clipped Button in css not as Expectedcss 中的剪辑按钮不符合预期
【发布时间】:2023-02-09 11:59:13
【问题描述】:

预期的

.clipped-button {
 height: 42px;
   min-width:120px;
  width: auto;
  display: block;
border:none;
  border-radius:2px;
  align-items:center;
clip-path: polygon(0px 0%, 0px 60%, 18px 100%, 100% 100%, 100% 40%, calc(100% - 18px) 0px);
  padding: 2.625px;
background-color: #993029;
}
.btn {
      width: 100%;
    height: 100%;
  

    background-color: rgb(205, 65, 58);
  display:flex;
   justify-content:center;
  align-items:center; 
    clip-path: polygon(0px 0%, 0px 60%, 16px 100%, 100% 100%, 100% 40%, calc(100% - 16px) 0px);
    color: rgb(255, 255, 255);
}
<button class="clipped-button"><div class="btn">Click Me</div>
</button>

没有让剪角变圆 如果可能的话,请帮忙把右上角和左下角的角弄圆

【问题讨论】:

    标签: html css clip-path


    【解决方案1】:

    而不是剪辑路径,也许类似于以下内容是一个选项。

    .button {
      display: inline-block;
      width: 200px;
      height: 50px;
      padding: 10px 20px;
      font-size: 1.2em;
      cursor: pointer;
      text-align: center;
      text-decoration: none;
      justify-content: center;
      align-items: center;
      outline: none;
      color: #fff;
      border-radius: 25px;
      border: 5px solid rgb(190, 40, 40);
      background-color: rgba(200, 60, 60, 0.6);
      background-image: linear-gradient(to bottom right, rgba(255,0,0,0), rgba(200, 60, 60, 0.8));
    }
    
    .button:hover {
      box-shadow: 0 10px 10px 0 rgba(0,0,0,0.2);
      /*--background-color: rgba(200, 60, 60, 1.0); --alt color--*/
      background-image: linear-gradient(to bottom right, rgba(255,0,0,0), rgba(250, 100, 100, 1.0));
    }
    
    .button span {
      cursor: pointer;
      display: inline-block;
      position: relative;
      transition: 0.5s;
    }
    
    .button span:after {
      content: 'F846 F846';
      position: absolute;
      opacity: 0;
      top: -2px;
      right: -40px;
      transition: 0.5s;
    }
    
    .button:hover span {
      padding-right: 40px;
    }
    
    .button:hover span:after {
      opacity: 1;
      right: 0;
    }
    &lt;button class="button"&gt;&lt;span&gt; Click Me &lt;/span&gt;&lt;/button&gt;

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2019-05-23
      • 1970-01-01
      • 2018-03-29
      • 2022-01-23
      • 2016-03-18
      相关资源
      最近更新 更多