【问题标题】:Draw triangle and under shape usinh HTML, CSS [duplicate]使用 HTML、CSS 绘制三角形和形状 [重复]
【发布时间】:2021-09-22 09:00:14
【问题描述】:

我正在创建一个 HTML 页面,该页面将在形状下写入文本,请参阅图片以获取参考。为了绘制这个形状,我使用以下方法:

#chevron {
  position: relative;
  text-align: center;
  padding: 12px;
  margin-bottom: 6px;
  height: 60px;
  width: 100%;
}

#chevron:before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  height: 100%;
  width: 51%;
  background: red;
  transform: skew(0deg, 6deg);
}

#chevron:after {
  content: '';
  position: absolute;
  top: 0;
  right: 0;
  height: 100%;
  width: 50%;
  background: red;
  transform: skew(0deg, -6deg);
}
<div style="width: 100%">
  <div id="chevron">
  </div>
</div>

但是,形状与我要绘制的形状完全不同。

这是期望的结果:

【问题讨论】:

    标签: html css


    【解决方案1】:

    您可以使用clip-path 这个website 非常适合掌握它

    在你的情况下,你需要这样的东西:

    clip-path: polygon(100% 0, 100% 15%, 50% 25%, 0 15%, 0 0);
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2018-04-26
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多