使用CSS重新样式化两个相邻的div

时间:2018-06-26 07:58:38

标签: html css

我被分配了一个任务来设计这样的两个div

image here

这是到目前为止我尝试过的,我想用一些CSS重新设置它的样式。 我非常感谢您提供有关样式的帮助。 (它不必与给定的图像相同。)

谢谢。 这是我的HTML和CSS代码 HTML代码:

.container {
  display: flex;
  flex-direction: row;
  flex-wrap: wrap;
}

.container .stage+.stage {
  margin-left: 30px;
}

.stage:before {
  content: "";
  position: absolute;
  width: 0;
  height: 0;
  left: 0;
  border-top: 100px solid transparent;
  border-left: 10px solid white;
  border-bottom: 110px solid transparent;
  margin: -10px 0px 0 0px;
}

.stage:after {
  color: #4D81BF;
  border-left: 20px solid;
  border-top: 100px solid transparent;
  border-bottom: 100px solid transparent;
  display: inline-block;
  content: '';
  position: absolute;
  right: -20px;
  top: 0;
}

.stage {
  background-color: #4D81BF;
  /*width: 150px; */
  height: 200px;
  line-height: 40px;
  display: inline-block;
  position: relative;
}

.stage {
  color: ;
  font-weight: bold;
  padding-left: 10px;
  font-family: Arial;
  font-size: 11;
}

#it,
#isms,
#bul {
  color: white;
}

#it {
  border: 3px solid white;
  background-color: green;
}

#isms,
#bul {
  border: 3px solid white;
  background-color: orange;
}
<div class="container">
  <div class="stage">
    <span class="blocktext">Stage Confirm</span>
    <div id="it">IT CONFIRM</div>
    <div id="isms">ISMS Confirm</div>
  </div>
  <div class="stage">
    <span class="blocktext">Stage Approve</span>
    <div id="bul">Bul Approve</div>
  </div>
</div>

1 个答案:

答案 0 :(得分:0)

我相信这会对您有所帮助。我想清理整个CSS,但是不想对原始代码进行很多更改,因此不会感到困惑。

.button {
  width: 200px;
  padding: 0 10px;
  box-sizing: border-box;
}

.container {
  display: flex;
  flex-direction: row;
  flex-wrap: wrap;
}

.container .stage+.stage {
  margin-left: 30px;
}

.stage:before {
  content: "";
  position: absolute;
  width: 0;
  height: 0;
  left: 0;
  border-top: 95px solid transparent;
  border-left: 70px solid white;
  border-bottom: 95px solid transparent;
  margin: -20px 0px 0 0px;
}

.stage:after {
  color: #4D81BF;
  border-left: 70px solid;
  border-top: 95px solid transparent;
  border-bottom: 95px solid transparent;
  display: inline-block;
  content: '';
  position: absolute;
  right: -70px;
  top: 0;
}

.stage {
  background-color: #4D81BF;
  /*width: 150px; */
  height: 150px;
  line-height: 40px;
  display: inline-block;
  position: relative;
  margin: 20px;
  font-weight: bold;
  padding: 20px 40px 20px 100px;
  font-family: Arial;
  font-size: 11;
}

#it,
#isms,
#bul {
  color: white;
}

#it {
  border: 3px solid white;
  background-color: green;
  margin: 0 0 10px 0;
}

#isms,
#bul {
  border: 3px solid white;
  background-color: orange;
}
<div class="container">
  <div class="stage">
    <span class="blocktext">Stage Confirm</span>
    <div id="it" class="button">IT CONFIRM</div>
    <div id="isms" class="button">ISMS Confirm</div>
  </div>
  <div class="stage">
    <span class="blocktext">Stage Approve</span>
    <div id="bul" class="button">Bul Approve</div>
  </div>
</div>