gpt4 book ai didi

jquery - 产品卡片标题每行高度相同问题

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

任何人都可以建议什么是使卡片标题每行高度相同的最佳方法,以便我的图像在底部的同一行上对齐。我正在寻找响应式解决方案。任何 CSS 技巧或 jQuery 插件?我一直在谷歌搜索,但没有找到任何类似的解决方案。

请注意,标题的绝对高度将不起作用,因为在浏览器调整大小时,标题会分成更多行,仍需要重新计算。谢谢

理想的最终结果: https://drive.google.com/file/d/1IeQ6X7R9utZzKTn8UdNFruInezJpX1V_/view?usp=sharing

See in codepen

https://codepen.io/edvardsniedre/pen/ymBdwg

最佳答案

@user2713970 我认为这段代码会对你有所帮助,检查一下。

           <style>
* { box-sizing: border-box; }

.card_image { width:100%; height:150px; }
body {
max-width: 960px; margin: 0 auto; padding: 40px 10px;
}

.cards
{ display: flex; justify-content: space-between; flex-wrap: wrap; }

.card {
width: 24%; border: 1px solid black;
margin-top: 10px; text-align: center;
}

img { width: 100%; }

.title { padding: 10px 0; }



@media only screen and (max-width: 700px) {
.cards {
.card {
width: 49%;
}
}
}



<body>
<div class="cards">
<div class="card">
<img class="card_image" src="https://encrypted-tbn0.gstatic.com/images?q=tbn:ANd9GcRfwXs8u99aFJFdhPx7oIgK1dLCkqQ14U7Yn4n1nvEwi_rgiWeYfg" alt="">
<div class="title">Title Title Title Title Title Title Title Title</div>
<div>$20</div>
</div>
<div class="card">
<img class="card_image" src="https://encrypted-tbn0.gstatic.com/images?q=tbn:ANd9GcQQKa0uIGrJO2QhidOcpE15BSVHK5uK3NNpH0ooXliy89IjeyK-bg" alt="">
<div class="title">Title Title Title </div>
<div>$20</div>
</div>
<div class="card">
<img class="card_image" src="https://envato-shoebox-0.imgix.net/4646/3935-85f4-41a0-b940-708875ee0a15/tajak+019.jpg?w=500&h=278&fit=crop&crop=edges&auto=compress%2Cformat&s=c45335aca948555287bc4229b1632950" alt="">
<div class="title">Title Title Title Title Title Title Title Title</div>
<div>$20</div>
</div>
<div class="card">
<img class="card_image" src="http://3v6x691yvn532gp2411ezrib-wpengine.netdna-ssl.com/wp-content/uploads/2019/05/imagetext01.jpg" alt="">
<div class="title">Title Title Title Title Title Title Title Title Title Title Title Title Title Title Title Title</div>
<div>$20</div>
</div>
<div class="card">
<img class="card_image" src="https://images.unsplash.com/photo-1535498730771-e735b998cd64?ixlib=rb-1.2.1&ixid=eyJhcHBfaWQiOjEyMDd9&w=1000&q=80" alt="">
<div class="title">Title Title Title Title Title Title Title Title Title Title Title Title Title Title Title Title</div>
<div>$20</div>
</div>
<div class="card">
<img class="card_image" src="https://i.kinja-img.com/gawker-media/image/upload/s--PnSCSSFQ--/c_scale,f_auto,fl_progressive,pg_1,q_80,w_800/z7jcryloxjedsztssw39.jpg" alt="">
<div class="title">Title Title Title Title Title Title Title Title Title Title Title Title Title Title Title Title Title Title Title Title Title Title Title Title Title Title Title Title Title Title Title Title</div>
<div>$20</div>
</div>
<div class="card">
<img class="card_image" src="https://cdn.pixabay.com/photo/2018/05/28/22/11/message-in-a-bottle-3437294__340.jpg" alt="">
<div class="title">Title Title Title Title Title Title Title Title</div>
<div>$20</div>
</div>
<div class="card">
<img class="card_image" src="https://www.esa.int/var/esa/storage/images/esa_multimedia/images/2018/03/italy_and_mediterranean/17402074-1-eng-GB/Italy_and_Mediterranean_node_full_image_2.jpg" alt="">
<div class="title">Title</div>
<div>$20</div>
</div>
</div>
</body>

关于jquery - 产品卡片标题每行高度相同问题,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/57094257/

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