如何在带有图像的圆圈之间放置线条?

How to place lines between circles with images?

我是 HTML 和 CSS 的初学者,所以我决定尝试代码 .psd 布局。不幸的是,我坚持使用那部分布局:

我的意思是带有图像的圆圈之间的线条。 这是我的代码:

html {
    font-size: 62.5%;
}

body {
  width: 1400px;
  font-family: "Roboto Slab", serif;
}

section {
  padding-right: 230px;
  padding-left: 230px;
}

.culture {
    padding-top: 100px;
    padding-bottom: 100px;
    background-color: #f9f9f9;
    overflow: auto;
}

h2 {
    font-family: "Montserrat", sans-serif;
    font-size: 4rem;
    color: #222;
    text-align: center;
}

.culture p {
    color: #777;
    text-align: center;
}

.culture > p {
    padding-top: 20px;
    padding-bottom: 89px;
    font-size: 2rem;
}

.value {
    float: left;
    padding-right: 56px;
}

.line {
    width: 170px;
    height: 2px;
    background-color: #777;
}

.value_img {
    width: 91px;
    height: 91px;
    margin: 0 auto 25px;
    border: 2px #777 solid;
    border-radius: 100%;
    background-repeat: no-repeat;
    background-position: center center;
}

.balance {
    background-image: url("http://d-k.aq.pl/note.png");
}

.quality {
    background-image: url("http://d-k.aq.pl/chart.png");
}

.excellence {
    background-image: url("http://d-k.aq.pl/star.png");
}

h3 {
    font-family: "Montserrat", sans-serif;
    font-size: 1.8rem;
    color: #222;
    text-align: center;
}

.value p {
    padding-top: 20px;
    font-size: 1.4rem;
}
<head>
  <link href="https://fonts.googleapis.com/css?family=Montserrat:400,700" rel="stylesheet" type="text/css">
  <link href="https://fonts.googleapis.com/css?family=Roboto+Slab:100,300,400,700" rel="stylesheet" type="text/css">
</head>
<section class="culture">
  <h2>
    CULTURE &amp; VALUES
  </h2>
  <p>
    Phasellus gravida ex at odio elementum.
  </p>
  <div class="value">
    <div class="value_img balance">
                        
    </div>
    <h3>
      WORK-LIFE BALANCE
    </h3>
    <p>
      Suspendisse ut odio vel felis pulvinar<br>
      sodales. Nunc ultricies nibh non velit<br>
      feugiat cursus. Phasellus scelerisque
    </p>
  </div>
  <div class="line">
                    
  </div>
  <div class="value">
    <div class="value_img quality">
                    
    </div>
    <h3>
      QUALITY OVER QUANTITY
    </h3>
    <p>
      Suspendisse ut odio vel felis pulvinar<br>
      sodales. Nunc ultricies nibh non velit<br>
      feugiat cursus. Phasellus scelerisque.
    </p>
  </div>
  <div class="line">
                    
  </div>
  <div class="value">
    <div class="value_img excellence">
                        
    </div>
    <h3>
      DELIVER EXCELLENCE
    </h3>
    <p>
      Suspendisse ut odio vel felis pulvinar<br>
      sodales. Nunc ultricies nibh non velit<br>
      feugiat cursus. Phasellus scelerisque.
    </p>
  </div>
</section>

我应该为他们使用绝对定位吗?

使用 .wrapperpadding 来设置所有项目的宽度。

.wrapper {
  display: flex;
  align-items: center;
  justify-content: space-around;
  padding: 0 10%;
  }

.item {
  border: 3px solid #777;
  width: 100px;
  height: 100px;
  border-radius: 50%;
  }
.line {
  border: 1px solid #777;
  margin: 0 2%;
  flex: 1 0;
  }
<div class="wrapper">
  <div class="item"></div>
  <div class="line"></div>
  <div class="item"></div>
  <div class="line"></div>
  <div class="item"></div>
</div>

您可以使用伪元素和负边距:

.value + .value .value_img:before {
  content: '';
  display: block;
  margin: 50px 0 0 -190px;
  width: 170px;
  height: 2px;
  background-color: #777;
}

.line {/* deleted from html */}

你也可以看看 display:flex 来设置布局而不是 floatmargin 也可以用来代替固定平均值 padding

html {
  font-size: 62.5%;
}
body {
  width: 940px;/* padding of section removed */
  font-family: "Roboto Slab", serif;
  margin: auto;
}
section {
  /* ?? 
  padding-right: 230px;
  padding-left: 230px;
  */
}
.culture {
  padding-top: 100px;
  padding-bottom: 100px;
  background-color: #f9f9f9;
  overflow: auto;
  display: flex;/* set things easily and will allow vertical and or horizontal alignements */
  flex-wrap: wrap;/* we need this here */
}
h2 {
  font-family: "Montserrat", sans-serif;
  font-size: 4rem;
  color: #222;
  text-align: center;
  width: 100%;
}
.culture p {
  color: #777;
  text-align: center;
}
.culture > p {
  padding-top: 20px;
  padding-bottom: 89px;
  font-size: 2rem;
  width: 100%;
}
.value {
  padding: 0 28px;/* around equally , helps to center things visually */
}
/* draw the lines here, .value + .value .. does not select first */
.value + .value .value_img:before {
  content: '';
  display: block;
  margin: 50px 0 0 -190px;
  width: 170px;
  height: 2px;
  background-color: #777;
}
.line {/* no need no more */} 
.value_img {
  width: 91px;
  height: 91px;
  margin: 0 auto 25px;
  border: 2px #777 solid;
  border-radius: 100%;
  background-repeat: no-repeat;
  background-position: center center;
}
.balance {
  background-image: url("http://d-k.aq.pl/note.png");
}
.quality {
  background-image: url("http://d-k.aq.pl/chart.png");
}
.excellence {
  background-image: url("http://d-k.aq.pl/star.png");
}
h3 {
  font-family: "Montserrat", sans-serif;
  font-size: 1.8rem;
  color: #222;
  text-align: center;
}
.value p {
  padding-top: 20px;
  font-size: 1.4rem;
}
<head>
  <link href="https://fonts.googleapis.com/css?family=Montserrat:400,700" rel="stylesheet" type="text/css">
  <link href="https://fonts.googleapis.com/css?family=Roboto+Slab:100,300,400,700" rel="stylesheet" type="text/css">
</head>
<section class="culture">
  <h2>
    CULTURE &amp; VALUES
  </h2>
  <p>
    Phasellus gravida ex at odio elementum.
  </p>
  <div class="value">
    <div class="value_img balance">

    </div>
    <h3>
      WORK-LIFE BALANCE
    </h3>
    <p>
      Suspendisse ut odio vel felis pulvinar
      <br>sodales. Nunc ultricies nibh non velit
      <br>feugiat cursus. Phasellus scelerisque
    </p>
  </div>

  <div class="value">
    <div class="value_img quality">

    </div>
    <h3>
      QUALITY OVER QUANTITY
    </h3>
    <p>
      Suspendisse ut odio vel felis pulvinar
      <br>sodales. Nunc ultricies nibh non velit
      <br>feugiat cursus. Phasellus scelerisque.
    </p>
  </div>

  <div class="value">
    <div class="value_img excellence">

    </div>
    <h3>
      DELIVER EXCELLENCE
    </h3>
    <p>
      Suspendisse ut odio vel felis pulvinar
      <br>sodales. Nunc ultricies nibh non velit
      <br>feugiat cursus. Phasellus scelerisque.
    </p>
  </div>
</section>