gpt4 book ai didi

css - 尝试在网页中定位 Divs?

转载 作者:行者123 更新时间:2023-11-28 10:38:05 24 4
gpt4 key购买 nike

我试图将它们定位成 2 行,每行 3 个“内容框”,但是当尝试对齐它们时,它们到处都是。有帮助吗?谢谢。

代码。

    .carbox {
float: left;
width: 400px;
height: 200px;
line-height: normal;
font-family: "Segoe UI", Tahoma, Geneva, Verdana, sans-serif;
color: #363F48;
}
.carlisting {
-webkit-box-shadow: 0px 0px 6px rgba(229, 238, 248, 1);
-moz-box-shadow: 0px 0px 6px rgba(229, 238, 248, 1);
box-shadow: 0px 0px 6px rgba(229, 238, 248, 1);
border: 1px solid #e9edf2;
margin-bottom: 50px;
-webkit-transition: all 0.35s ease-in-out;
-moz-transition: all 0.35s ease-in-out;
-ms-transition: all 0.35s ease-in-out;
-o-transition: all 0.35s ease-in-out;
transition: all 0.35s ease-in-out;
-webkit-border-radius: 2px;
-moz-border-radius: 2px;
border-radius: 2px;
background: #ffffff;
}
.toprow {
height: 107px;
border-bottom: lightgray 1px solid;
}
.carinfo {
height: 107px;
float: right;
width: 50%;
}
.carinfo .title {
height: 53.5px;
font-size: 20px;
line-height:53px;
}
.carinfo .price {
height: 53.5px;
}
.carinfo .price span {
color: white;
height: 18px;
width: 50px;
padding:2px 4px;
background-color: #363F48;
cursor:pointer;
}
.btrow span {
border-right: 1px lightgray solid;
margin:5px 4px;
}

HTML(注意顶部有一个容器,它是边距等。

    <div class="container">
<div class="carbox">
<div class="carlisting">
<div class="toprow">
<img height="107px" src="http://demo.swebdesignstudio.com/templates/carell/car_dealer/images/car-1.jpg" width="186px" />
<div class="carinfo">
<div class="title">Honda</div>
<div class="price"><span>£999.99</span></div>
</div>
</div>
<div class="btrow">
<span>2012</span> <span>100bhp</span> <span>12,000mi</span>
<span>Manual</span> </div>
</div>
</div>
<div class="carbox">
<div class="carlisting">
<div class="toprow">
<img height="107px" src="http://demo.swebdesignstudio.com/templates/carell/car_dealer/images/car-1.jpg" width="186px" />
<div class="carinfo">
<div class="title">Honda</div>
<div class="price"><span>£999.99</span></div>
</div>
</div>
<div class="btrow">
<span>2012</span> <span>100bhp</span> <span>12,000mi</span>
<span>Manual</span> </div>
</div>
<div class="carbox">
<div class="carlisting">
<div class="toprow">
<img height="107px" src="http://demo.swebdesignstudio.com/templates/carell/car_dealer/images/car-1.jpg" width="186px" />
<div class="carinfo">
<div class="title">Honda</div>
<div class="price"><span>£999.99</span></div>
</div>
</div>
<div class="btrow">
<span>2012</span> <span>100bhp</span> <span>12,000mi</span>
<span>Manual</span> </div>
</div>
<div class="container">
<div class="carbox">
<div class="carlisting">
<div class="toprow">
<img height="107px" src="http://demo.swebdesignstudio.com/templates/carell/car_dealer/images/car-1.jpg" width="186px" />
<div class="carinfo">
<div class="title">Honda</div>
<div class="price"><span>£999.99</span></div>
</div>
</div>
<div class="btrow">
<span>2012</span> <span>100bhp</span> <span>12,000mi</span>
<span>Manual</span> </div>
</div>
</div>
<div class="carbox">
<div class="carlisting">
<div class="toprow">
<img height="107px" src="http://demo.swebdesignstudio.com/templates/carell/car_dealer/images/car-1.jpg" width="186px" />
<div class="carinfo">
<div class="title">Honda</div>
<div class="price"><span>£999.99</span></div>
</div>
</div>
<div class="btrow">
<span>2012</span> <span>100bhp</span> <span>12,000mi</span>
<span>Manual</span> </div>
</div>
<div class="carbox">
<div class="carlisting">
<div class="toprow">
<img height="107px" src="http://demo.swebdesignstudio.com/templates/carell/car_dealer/images/car-1.jpg" width="186px" />
<div class="carinfo">
<div class="title">Honda</div>
<div class="price"><span>£999.99</span></div>
</div>
</div>
<div class="btrow">
<span>2012</span> <span>100bhp</span> <span>12,000mi</span>
<span>Manual</span> </div>
</div>
</section>

截图:

https://dl-web.dropbox.com/get/Screenshots/Screenshot%202014-04-23%2022.41.37.png?_subject_uid=15468544&w=AADDCyCb4DCHjvJkraYMb1RDu90iqHThnQV_z203Fit2UA

最佳答案

你有很多缺失</div>

这是您的代码示例。我使用百分比而不是宽度的 px 值。

http://jsfiddle.net/Kfg4L/

关于css - 尝试在网页中定位 Divs?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/23255775/

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