我有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