将div底部放在float div中

时间:2014-10-13 13:05:45

标签: html css styles position

请看这个。

http://jsfiddle.net/snw5rgx9/3/

或这个新的stackoverflow代码段。

.image {
    float: left;
    margin-right: 10px;
}

.text {
    height: 100px;
    position: relative;
}

.bottom-left {
    position: absolute;
    bottom: 0;
}
<div class="container">
    <div class="image">
        <img src="http://placehold.it/100x100" />
    </div>
    <div class="text">
        asd
        <div class="bottom-left">
            Delete &bull; Edit
        </div>
    </div>
</div>

我有一个div左下角div的位置问题。

另外

X | Text
  | Bottom

看起来像这样。

X | Text
Bottom

先感谢您提供信息。

2 个答案:

答案 0 :(得分:1)

我不确定我是否完全不支持这个问题,但是尝试为.text添加margin-left,图像宽度的值为+10(以对齐顶部文本,其左边有10px,像这样:

.text {
    height: 100px;
    position: relative;
    margin-left: 110px;
}

http://jsfiddle.net/snw5rgx9/5/

答案 1 :(得分:0)

应用浮动后,您需要清除下一个div。

如果您想清楚明确样式Click this link..

  

.text {       身高:100px;       明确:两者;       位置:相对;   }