gpt4 book ai didi

html - CSS 图像向左浮动错误

转载 作者:太空宇宙 更新时间:2023-11-04 12:57:34 25 4
gpt4 key购买 nike

我是一名 UI 设计师。我希望每张图片都漂浮在另一张下方的左边。但它看起来像。 http://delhiwebdesigner.com/images/Capture.png请检查问题出在哪里。下面是我的 HTML 和 CSS 代码:

<div class="books-container">
<article class="entry">
<img src="images/books/1.jpg" alt="" title="" />
<a href="#">
<div class="text">
<p class="head">LeMans</p>
<p class="title">LeMans</p>
</div>
</a>
</article>

<article class="entry">
<img src="images/books/2.jpg" alt="" title="" />
<a href="#">
<div class="text">
<p class="head">LeMans</p>
<p class="title">LeMans</p>
</div>
</a>
</article>

<article class="entry">
<img src="images/books/4.jpg" alt="" title="" />
<a href="#">
<div class="text">
<p class="head">LeMans</p>
<p class="title">LeMans</p>
</div>
</a>
</article>

<article class="entry">
<img src="images/books/3.jpg" alt="" title="" />
<a href="#">
<div class="text">
<p class="head">LeMans</p>
<p class="title">LeMans</p>
</div>
</a>
</article>

<article class="entry">
<img src="images/books/5.jpg" alt="" title="" />
<a href="#">
<div class="text">
<p class="head">LeMans</p>
<p class="title">LeMans</p>
</div>
</a>
</article>

<article class="entry">
<img src="images/books/6.jpg" alt="" title="" />
<a href="#">
<div class="text">
<p class="head">LeMans</p>
<p class="title">LeMans</p>
</div>
</a>
</article>

<article class="entry">
<img src="images/books/7.jpg" alt="" title="" />
<a href="#">
<div class="text">
<p class="head">LeMans</p>
<p class="title">LeMans</p>
</div>
</a>
</article>

<article class="entry">
<img src="images/books/8.jpg" alt="" title="" />
<a href="#">
<div class="text">
<p class="head">LeMans</p>
<p class="title">LeMans</p>
</div>
</a>
</article>

<article class="entry">
<img src="images/books/9.jpg" alt="" title="" />
<a href="#">
<div class="text">
<p class="head">LeMans</p>
<p class="title">LeMans</p>
</div>
</a>
</article>

<article class="entry">
<img src="images/books/10.jpg" alt="" title="" />
<a href="#">
<div class="text">
<p class="head">LeMans</p>
<p class="title">LeMans</p>
</div>
</a>
</article>

<article class="entry">
<img src="images/books/11.jpg" alt="" title="" />
<a href="#">
<div class="text">
<p class="head">LeMans</p>
<p class="title">LeMans</p>
</div>
</a>
</article>

<article class="entry">
<img src="images/books/12.jpg" alt="" title="" />
<a href="#">
<div class="text">
<p class="head">LeMans</p>
<p class="title">LeMans</p>
</div>
</a>
</article>

<article class="entry">
<img src="images/books/13.jpg" alt="" title="" />
<a href="#">
<div class="text">
<p class="head">LeMans</p>
<p class="title">LeMans</p>
</div>
</a>
</article>

<div class="clear"></div>

CSS 代码如下:-

 .books-container {
width: 1200px;
margin: 100px auto 0;
}

.entry {
width: 25%;
float: left;
height: auto;
padding: 10px;
position: relative;
}

.entry img {
width: 100%;
display: block;
}

.entry .text {
position: absolute;
display: none;
top: 0;
vertical-align: middle;
height: 100%;
background: red;
opacity: 0.5;
text-align: center;
width: 100%;
padding: 10px;
}

最佳答案

http://jsfiddle.net/6deqxyk4/4/

.books-container {max-width: 1200px;width:100%; margin: 100px auto 0;}
.entry {width:400px; float: left; height: auto; padding: 10px; position: relative;}
.entry img {width: 100%; display: block;}
.entry .text {position: absolute; display: none; top: 0; vertical-align: middle; height: 100%; background: red; opacity: 0.5; text-align: center; width: 100%; padding: 10px;}

关于html - CSS 图像向左浮动错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/25697515/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com