gpt4 book ai didi

css - opencart 清除 :both generates a gap

转载 作者:行者123 更新时间:2023-11-28 18:48:28 25 4
gpt4 key购买 nike

http://demo.opencart.com/index.php?route=product/product&product_id=42

enter image description here

如果你使用 firebug,或者 chrome 的 inspect element 并插入这段代码

<div style="background:blue;width:100px;height:100px;float:left;"></div>
<div style="background:green;width:100px;height:100px;float:right;"></div>
<div style="clear:both;"></div>

在 .product-info .right 中,你会得到一个大约 400 像素高度的空白区域。如果我尝试修改我的模板,也会发生同样的情况。

如果我创建一个 html 文档并粘贴相同的代码,它会工作正常

<html>
test<br />

<div style="background:blue;width:100px;height:100px;float:left;"></div>
<div style="background:green;width:100px;height:100px;float:right;"></div>
<div style="clear:both;"></div>

test again
</html>

问题显然出在 opencart 的某个地方,但我找不到。

编辑:如果我把 display:none;在左列上它不会产生间隙,因此左列有问题。

编辑:我自己找到了解决方案。我通过 float 右列来修复 float

.product-info .right {
float:right;
width:470px;
margin:0;
}

最佳答案

你的 HTML 结构应该是这样的

<div class="right">

<div style="overflow: hidden; margin-bottom: 10px;">
<div style="background:blue;width:100px;height:100px;float:left;"></div>
<div style="background:green;width:100px;height:100px;float:right;"></div>
</div>


<div style="" class="description"> <!-- remove the style clear:both -->
<span>Brand:</span> <a href="http://demo.opencart.com/index.php?route=product/manufacturer/product&amp;manufacturer_id=8">Apple</a><br>
<span>Product Code:</span> Product 15<br>
<span>Reward Points:</span> 100<br>
<span>Availability:</span> In Stock
</div>

......
your remaining divs goes here
.....

</div>

屏幕截图:

enter image description here

关于css - opencart 清除 :both generates a gap,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/9956809/

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