Div正在通过CSS占用空间,它不应该

时间:2015-07-31 14:58:14

标签: html css

我目前正在尝试设置一个帖子,该帖子将出现在我的网站上,并在css的早期阶段布置所有内容。我对所有内容进行了颜色编码,以便更容易看到最新情况。你可以在这里看到它:https://jsfiddle.net/k3wpz49b/

我的问题是,我有一个名为details_wrapper的最后一个div应该去红色部分,但它一直向左移动。当我检查镀铬时,它说它占据了整个空间。我无法弄清楚为什么会这样。

我的代码在这里:

<div class="post_wrapper">
<div class="profile_image">


</div>
<div class="body_wrapper">
    <div class="title">

    </div>
    <div class="description">

    </div>
</div>
<div class="details_wrapper">

</div>

    .post_wrapper{
    width: 800px;
    height: 150px;
    background-color: red;
}
.profile_image{
    width: 175px;
    height: 150px;
    background-color: black;
    float: left;
}
.body_wrapper{
    width: 475px;
    height: 150px;
    background-color: gray;
    float: left;
}
.title{
    height: 40px;
    width: 450px;
    margin: 10px;
    background-color: blue;
}
.description{
    height: 80px;
    width: 450px;
    margin: 10px;
    background-color: green;
}
.details_wrapper{
    height: 150px;
    width: 100px;
    background-color: purple;
}

1 个答案:

答案 0 :(得分:1)

您只需将details_wrapper添加到def __init__(self): self.cycle = None self.cell = None self.bIsTilted = False # Assume trays are not tilted self.bSendNoData = False # Assume data is sent, modified later if data not sent self.trayData = (self.cycle, self.cell, self.bIsTilted, self.bSendNoData) def __repr__(self): return str(self.trayData) def setCycle(self, cycle): self.cycle = cycle self.trayData = (self.cycle, self.cell, self.bIsTilted, self.bSendNoData) def setCell(self, cell): self.cell = cell self.trayData = (self.cycle, self.cell, self.bIsTilted, self.bSendNoData)

即可

https://jsfiddle.net/k3wpz49b/5/