如何使这个广场与下面的样式

问题描述 投票:-1回答:1

我需要建立这种风格在CSS中,但我不能。所散发出来的唯一的事情是一个正方形,我已经相当沮丧。我是新来的CSS,我将不胜感激,如果你能帮助我。

https://i.imgur.com/fVKVrG4.png

谢谢!

我试图用之前和之后做,但它不工作


.rectangle:before {
  right: 10%;
  border-right: 100px solid transparent;
  border-left: 100x solid;
}

.rectangle:after {
  left: 50%;
  border-left: 100px solid transparent;
  border-right: 100px solid;
}
css
1个回答
1
投票

尝试这个:

#div {
  background: red;
  display: inline-block;
  height: 55px;
  margin-left: 20px;
  margin-top: 55px;
  position: relative;
  width: 100px;
}
#div:before {
  border-top: 35px solid red;
  border-left: 50px solid transparent;
  border-right: 50px solid transparent;
  content: "";
  height: 0;
  left: 0;
  position: absolute;
  top: 55px;
  width: 0;
}

JS Fiddle

我看着CSS Tricks的形状的名单,发现类似的是你所寻找的东西。

© www.soinside.com 2019 - 2024. All rights reserved.