css SWOT分析箱设计

xnifntxz  于 12个月前  发布在  其他
关注(0)|答案(1)|浏览(74)

我试图创建波纹管框

我用下面的HTM代码

.noMargin {
 margin: 0px;
}
 .bordertp {
 border-top: 1px solid grey;
}
 .borderbtm {
 border-bottom: 1px solid grey;
}
 .borderright{
 border-right: 1px solid grey;
}
 .borderleft{
 border-left: 1px solid grey;
}
<div class="container">
  <div class="row noMargin bordertp borderleft borderright">
<div class="col one borderright"> one </div>
<div class="col two"> two </div>
  </div>
  <div class="row noMargin borderbtm borderleft borderright">
<div class="col three"> three </div>
<div class="col four"> four </div>
  </div>
</div>

但不能想出如何添加十字架在中间和4个彩色框和数字。简单的方法来存档。如果有人已经做了

e7arh2l6

e7arh2l61#

你必须添加更多的CSS和HTML来做这件事,然后它是一个有点简单。才能让那些混蛋乖乖听话
在我的代码中,你可以看到我将数字和字符 Package 在一个新的div中,以便将它们正确地与其他的对齐。

<div class="container">
            <div class="row noMargin">
                <div class="col">
                  <div class="number">
                    5
                  </div>
                  <div class="text">
                    S
                  </div>
                </div>
                <div class="col">
                  <div class="number">
                    1
                  </div>
                  <div class="text">
                    W
                  </div>
                </div>
            </div>
            <div class="row noMargin">
                <div class="col">
                  <div class="number">
                    3
                  </div>
                  <div class="text">
                    O
                  </div>
                </div>
                <div class="col">
                  <div class="number">
                    0
                  </div>
                  <div class="text">
                    T
                  </div>
                </div>
            </div>
        </div>

我使用css的'+'选择器和:first-child选择器来定位正确的div,而不给它们指定特定的类。这些运算符解释为here

.noMargin {
  margin: 0px;
}
.row {
  display: flex;
}
/* Select second row (following on other row) */
.row + .row {
  border-top: 1px solid grey;
} 
.row .col {
  padding: 10px 20px;
  width: 50%;
  display: flex;
  flex-direction: column;
}
.row .col + .col {
  border-left: 1px solid grey;
}

.row .col + .col .number {
  align-self: flex-end;
}

.row .col:first-child .text {
  align-self: flex-end;
}

你还需要添加颜色。

相关问题