html - 将一个 div 放在 float div 的左下角

标签 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>

我对左下角 float 的 div 的位置有疑问。

还有

X | Text
  | Bottom

看起来像这样。

X | Text
Bottom

提前感谢您提供信息。

最佳答案

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

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

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

关于html - 将一个 div 放在 float div 的左下角,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/26340702/

相关文章:

html - 学习Bootstrap,如何在其他之后正确地制作列堆栈

javascript - 使用 canvas.captureStream() 捕获带有 alpha channel 的视频

html - 输入为空时如何隐藏部分css?

css - 为什么浏览器要为 CSS 属性创建供应商前缀?

c# - 允许跨应用程序复制/粘贴 XamDataGrid

javascript - 使用 Angular 更改类的 CSS 属性值

html - iOS打破背景大小

css - 使用 CSS 修复自定义字体行高

javascript - 等高仅行与 javascript 没有表

jquery - 使用 JQuery 从 head 标签中动态删除样式