我不知道我错过了什么。我试图用这4篇文章做一个2x2的盒子。我现在能做什么?我不能让它工作。我还把所有的div封装到一个
@import url('https://fonts.googleapis.com/css?family=Roboto+Condensed:700|Roboto:100,300,700');
html,body{
margin:0;
padding:0;
font-family: Roboto;
font-size: 10px;
line-height:3.5;
font-weight:300;
}
h1,h2,h3,h4,h5{
font-family:Roboto Condensed;
}
h1{
font-size:9em;
text-align:center;
text-transform:uppercase;
}
h2{
font-size:5em;
text-align:center;
text-transform:uppercase;
line-height:4em;
color:white;
text-shadow: #020819 8px -20px 9px
}
h3{
font-size:4.2em;
text-align:center;
line-height:1em;
margin-top:0;
}
h4{
font-size:1.5em;
letter-spacing:0.4;
line-height:1em;
}
h5{
font-size:1.2em;
line-height:1em;
margin-top:0;
margin-bottom:0;
}
.service-box{
font-size:1.7em;
text-align:center;
border:2px solid #eee;
border-radius:20px;
boxing-size:border-box;
box-shadow: 2px 2px 10px 0 #eee;
margin:50px 5% 0 5%;
padding:20px;
width:40%
}
.service-box img{
width:150px;
}
#structure div {
display: flex;
justify-content: space-between;
flex-direction:row;
flex-wrap: wrap;
}
<section id="structure " >
<div>
<article class="service-box" >
<img src="https://s3-eu-west-1.amazonaws.com/ih-materials/uploads/ironskydive-training.png">
<h3>Training</h3>
<p>We teach all the necessary things to jump from the plane without any kind of problem.</p>
</article>
</div>
<div >
<article class="service-box">
<img src="https://s3-eu-west-1.amazonaws.com/ih-materials/uploads/ironskydive-get-ready.png" >
<h3>Get Ready</h3>
<p>You are already prepared, you just need the suit and a parachute. All sizes available.</p>
</article>
</div>
<div >
<article class="service-box">
<img src="https://s3-eu-west-1.amazonaws.com/ih-materials/uploads/ironskydive-fly.png">
<h3>Fly</h3>
<p>You are ready, and the plane is waiting for us in the hangar. Let's fly</p>
</article>
</div>
<div >
<article class="service-box">
<img src="https://s3-eu-west-1.amazonaws.com/ih-materials/uploads/ironskydive-jump.png">
<h3>Jump!</h3>
<p>You have done the most complicated. just one step left... jump!!</p>
</article>
</div>
</section>
放置一个类并选择#structure .(div class)
,并将属性设置为flex,所有这些似乎都不起作用。
Codepen
2条答案
按热度按时间e37o9pze1#
你需要改变你的html的结构,也改变宽度:40%到宽度:40vw,你应该都设置好了
cfh9epnr2#
你想要一个2x2的网格,因此你应该使用网格而不是Flexbox。