我有3周的div相同的類是這樣的:不能內聯內3個div的按鈕具有相同的類
<main>
<div class="item">
<img src="images/StormTrooper.png" alt="" />
<h3>Return of the Jedi</h3>
<p>E P I S O D E 6</p>
<button type="button" name="button">Watch Now</button>
</div>
<div class="item">
<img src="images/R2D2.png" alt="" />
<h3>The Force Awakens</h3>
<p>E P I S O D E 7</p>
<button type="button" name="button">Watch Now</button>
</div>
<div class="item">
<img src="images/Falkon.png" alt="" />
<h3>The Last Jedi</h3>
<p>E P I S O D E 8</p>
<button type="button" name="button">Watch Now</button>
</div>
</main>
的問題是,裏面的元素divs不是內聯排序的,也不知道爲什麼。這裏是我的CSS:
@import "https://fonts.googleapis.com/css?family=Lato";
* {
margin: 0;
padding: 0
}
main {
font-family: Lato, sans-serif;
background: #729fcf;
padding: 20px;
display: flex;
justify-content: center;
}
.item {
background: #f0ebff;
width: 300px;
height: 350px;
margin: 20px;
text-align: center;
padding: 20px;
box-sizing: border-box; float: left;
}
.item img {
width: 100px;
display: inline;
}
.item h3 {
text-transform: uppercase;
margin: 15px 0;
}
.item p {
margin: 35px 0;
font-size: 12px;
}
.item button {
background: 0;
padding: 10px;
border: 3px solid #6076cc;
border-radius: 10px;
font-size: 12px;
margin-top: 35px;
}
[1]: https://i.stack.imgur.com/2QxOA.jpg
長話短說,預期的輸出是下面的圖片: 有一點幫助,將不勝感激。
把同樣大小的圖片在所有三個div的 – Nivedita