我不确定如何正确解释这一点,但我正在尝试获取一个元素列表来环绕一个块。
这是我的意思的图像:
代码如下。如果只有 2 个块,它会正确地向左浮动,但是当我添加更多块时,它会下降到欢迎块下方(如图所示)。
该设计在欢迎框旁边显示了 2 个街区,然后在下方显示了 3 个街区。因此,在图像中,第 3 个块应位于欢迎块下方,后续块将继续正常(每行 3 个块)。
CSS
#welcome-block {
float: left;
width: 300px;
background: #fff;
}
#bingo-offers {
float: left;
margin: 0;
padding: 0;
overflow: hidden;
}
.bingo-offer {
float: left;
width: 300px;
background: #fff;
margin: 5px;
}
.bingo-offer ul {
margin: 0;
padding: 0;
}
HTML
<div>
<div id="welcome-block">
<h2>Welcome to Zesty Bingo</h2>
<p>Zesty Bingo is the home of FREE Bingo!</p>
<p>We have a huge selection of Bingo games to choose. Simple find a game, and click play. It’s as simple
as that.</p>
<p>Ensure you click the read more link on each game to find out more details and customer reviews on all
of our hosted games.</p>
<p>Good Luck and we wish you wealth and happiness from all the Zesty Bingo team.</p>
</div>
<ul id="bingo-offers">
<li class="bingo-offer">
<ul>
<li><img src="../img/winkbingo-146.png" alt=""></li>
<li><h3>Wink Bingo</h3></li>
<li>Free Cash: <span>£20</span></li>
<li>Join one of the biggest Bingo sites on the Internet and enjoy a whopping £20 bonus when you deposit £5!</li>
<li><a href="#">Play Now</a></li>
<li><a href="#">read more</a></li>
</ul>
</li>
<li class="bingo-offer">
<ul>
<li><img src="../img/winkbingo-146.png" alt=""></li>
<li><h3>Wink Bingo</h3></li>
<li>Free Cash: <span>£20</span></li>
<li>Join one of the biggest Bingo sites on the Internet and enjoy a whopping £20 bonus when you deposit £5!</li>
<li><a href="#">Play Now</a></li>
<li><a href="#">read more</a></li>
</ul>
</li>
<li class="bingo-offer">
<ul>
<li><img src="../img/winkbingo-146.png" alt=""></li>
<li><h3>Wink Bingo</h3></li>
<li>Free Cash: <span>£20</span></li>
<li>Join one of the biggest Bingo sites on the Internet and enjoy a whopping £20 bonus when you deposit £5!</li>
<li><a href="#">Play Now</a></li>
<li><a href="#">read more</a></li>
</ul>
</li>
<li class="bingo-offer">
<ul>
<li><img src="../img/winkbingo-146.png" alt=""></li>
<li><h3>Wink Bingo</h3></li>
<li>Free Cash: <span>£20</span></li>
<li>Join one of the biggest Bingo sites on the Internet and enjoy a whopping £20 bonus when you deposit £5!</li>
<li><a href="#">Play Now</a></li>
<li><a href="#">read more</a></li>
</ul>
</li>
<li class="bingo-offer">
<ul>
<li><img src="../img/winkbingo-146.png" alt=""></li>
<li><h3>Wink Bingo</h3></li>
<li>Free Cash: <span>£20</span></li>
<li>Join one of the biggest Bingo sites on the Internet and enjoy a whopping £20 bonus when you deposit £5!</li>
<li><a href="#">Play Now</a></li>
<li><a href="#">read more</a></li>
</ul>
</li>
<li class="bingo-offer">
<ul>
<li><img src="../img/winkbingo-146.png" alt=""></li>
<li><h3>Wink Bingo</h3></li>
<li>Free Cash: <span>£20</span></li>
<li>Join one of the biggest Bingo sites on the Internet and enjoy a whopping £20 bonus when you deposit £5!</li>
<li><a href="#">Play Now</a></li>
<li><a href="#">read more</a></li>
</ul>
</li>
<li class="bingo-offer">
<ul>
<li><img src="../img/winkbingo-146.png" alt=""></li>
<li><h3>Wink Bingo</h3></li>
<li>Free Cash: <span>£20</span></li>
<li>Join one of the biggest Bingo sites on the Internet and enjoy a whopping £20 bonus when you deposit £5!</li>
<li><a href="#">Play Now</a></li>
<li><a href="#">read more</a></li>
</ul>
</li>
</ul>
</div>