1
我想將這些卡片準確放置在淺藍色背景的中間。而且,當我縮小瀏覽器時,卡片之間的空間也應該減少。 (我使用的瀏覽器。)如何在柔性容器中插入卡片
這是不工作我的style.css文件
.flex-item{
height: 350px;
width: 250px;
background-color: white;
text-align: center;
margin: 15px;
display: inline-block;
border: 1px solid #ccc;
box-shadow: 0px 5px 25px #aaa;
border-radius: 10px;
}
.flex-container{
display: flex;
webkit-justify-content: center;
height:380px;
background-color: lightblue;
}
HTML:
<!-- cards -->
<div class="flex-container">
<div class="row">
<div class="col-md-3 flex-item" >
<img src="bg.jpg" class="img img-responsive" style="margin-bottom:5px; margin-top:10px; border-radius:250px;">
<legend>Section</legend>
<p>Lorem ipsum dolor sit amet glo dlbogn</p>
<button class="btn btn-success btn-sm" style="float:right;" >Read More</button>
</div>
<div class="col-md-3 flex-item" >
<img src="bg.jpg" class="img img-responsive" style="margin-bottom:5px; margin-top:10px; border-radius:250px;">
<legend>Section</legend>
<p>Lorem ipsum dolor sit amet glo dlbogn</p>
<button class="btn btn-success btn-sm" style="float:right;" >Read More</button>
</div>
<div class="col-md-3 flex-item" >
<img src="bg.jpg" class="img img-responsive" style="margin-bottom:5px; margin-top:10px; border-radius:250px;">
<legend>Section</legend>
<p>Lorem ipsum dolor sit amet glo dlbogn</p>
<button class="btn btn-success btn-sm" style="float:right;" >Read More</button>
</div>
</div>
</div>
其工作..謝謝:)但你能解釋一下,請問text-align屬性影響的卡?據我所知,它應該隻影響文本。即時新手。 –
@ MD.TAWSIF-UL-KARIMTawsif它也影響內聯元素。這就是爲什麼它會影響'display:inline-block'元素。 – Justinas