从div中剪切/遮罩三角形(标志形状)

时间:2019-10-08 09:58:58

标签: html css

我想创建一个标志外观(摘要),所以蓝色三角形看起来像是切掉的。

该代码段仅代表一个想法,它的工作方式与我想要的完全不同。

.box {

  position: absolute;
  top: 0;
  right: 0;
  background-color: #ca0000;
  display: inline-block;
  color: #fff;
  font-size: 20px;
  padding-left: 80px;
  padding-right: 10px;
  height: 50px;
  line-height: 45px;

}

.box:after {

  content: "";
  position: absolute;
  left: 0;
  bottom: 0;
  width: 0;
  height: 0;
  border-left: 25px solid blue;
  border-top: 25px solid transparent;
  border-bottom: 25px solid transparent;
  z-index: 1;

}
<div class="box">
hehe
</div>

0 个答案:

没有答案