gpt4 book ai didi

html - 如何使用 CSS [Twitter Bootstrap] 创建类似 Pinterest 的网格

转载 作者:行者123 更新时间:2023-11-28 06:52:43 27 4
gpt4 key购买 nike

在这里,我试图让 Pinterest 像网格一样。我正在使用 Bootstrap 列网格布局。我想为这些列应用 Pinterest 样式网格。我已经添加了 CSS 来实现它,但我正在像下面那样截断列。没有用于此的 jQuery。我怎样才能使新元素从头开始并避免元素被砍掉?

enter image description here

HTML

<div class="row listpage-row masonry-container product-list">

<div class='col-xs-10 col-sm-4 col-md-3 col-lg-3 shop-item'>
<div class='panel panel-warning'>
<div class='panel-body'>
<a href="product-description.php?product_id=3">
<br>
<br>
<img class='product_listing_img img-responsive' src=files/uploaded_images/Numark.jpg>
<br><a href="product-description.php?product_id=3" class="productname">Numark Ns7Ii 4-Channel Motorized Dj Controller And Mixer</a>
<br>
<br>
</a><span class='price'>&#8377;24000/-</span>
<h4><span>&#8377;<strike class='maxprice'>119852</strike></span></h4><span class='owners'>8 of 0 owners reached</span><a href='mycart.php?action=add&product_id=3' class='buy-button btn btn-warning col-xs-12 col-sm-12 col-md-12 col-lg-12'><span class='glyphicon glyphicon-shopping-cart'></span> Add to cart</a>
</div>
</div>
</div>

<div class='col-xs-10 col-sm-4 col-md-3 col-lg-3 shop-item'>
<div class='panel panel-warning'>
<div class='panel-body'>
<a href="product-description.php?product_id=4">
<br>
<br>
<img class='product_listing_img img-responsive' src=files/uploaded_images/yamaha.jpg>
<br><a href="product-description.php?product_id=4" class="productname">Yamaha 01V96i Digital Mixer</a>
<br>
<br>
</a><span class='price'>&#8377;88630/-</span>
<h4><span>&#8377;<strike class='maxprice'>227900</strike></span></h4><span class='owners'>4 of 1 owners reached</span><a href='mycart.php?action=add&product_id=4' class='buy-button btn btn-warning col-xs-12 col-sm-12 col-md-12 col-lg-12'><span class='glyphicon glyphicon-shopping-cart'></span> Add to cart</a>
</div>
</div>
</div>

<div class='col-xs-10 col-sm-4 col-md-3 col-lg-3 shop-item'>
<div class='panel panel-warning'>
<div class='panel-body'>
<a href="product-description.php?product_id=5">
<br>
<br>
<img class='product_listing_img img-responsive' src=files/uploaded_images/3b8b57e428a568786e411c3fa09b6a3e.jpg>
<br><a href="product-description.php?product_id=5" class="productname">Brother P Touch Label Printer</a>
<br>
<br>
</a><span class='price'>&#8377;2181/-</span>
<h4><span>&#8377;<strike class='maxprice'>6000</strike></span></h4><span class='owners'>8 of 0 owners reached</span><a href='mycart.php?action=add&product_id=5' class='buy-button btn btn-warning col-xs-12 col-sm-12 col-md-12 col-lg-12'><span class='glyphicon glyphicon-shopping-cart'></span> Add to cart</a>
</div>
</div>
</div>

</div>

CSS:

.listpage-row {
-moz-column-width: 15em;
-webkit-column-width: 15em;
-moz-column-gap: 0.5em;
-webkit-column-gap: 0.5em;
}
.shop-item {
display: block;
padding: 0.1rem;
width: 100%;
}

最佳答案

使用自定义 CSS 固定面板的高度:

.panel-body{
height:350px;
}

看看this fiddle

关于html - 如何使用 CSS [Twitter Bootstrap] 创建类似 Pinterest 的网格,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/33690076/

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