css - 我如何在 Twitter Bootstrap css 框架中正确定位绝对 div

标签 css twitter-bootstrap positioning absolute

我似乎无法使用 twitter bootstrap 框架将 div 绝对定位在其父项中。我有一系列遵循如下方案的行

<div id='wrapper'>
<div class='row-fluid'>
    <div class='span2'>some content here</div>
    <div class='span9'>other content to the side of the first div</div>
    <div class='timestamp'>123456 this should align to the bottom right of wrapper</div>
</div>
</div>

CSS

.timestamp{
   position:absolute;
   bottom:0px;
   right:0px;
}

但是时间戳 div 始终将自己定位到整个 dom 文档主体的绝对位置,忽略任何中间 div。知道是什么原因造成的吗?

最佳答案

你的CSS应该包括

 #wrapper {
    position: relative;
}

默认定位是静态的。

查看这篇文章: http://css-tricks.com/absolute-positioning-inside-relative-positioning/

关于css - 我如何在 Twitter Bootstrap css 框架中正确定位绝对 div,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/9898814/

相关文章:

javascript - 如何定义组件是否嵌套在 Angular 6 中?

css - 用百分比保持/缩放 DIV 比率

css - 如何使用 CSS 将按钮移动到新行?

html - 如何使用 BootStrap 框架更改此 block 的背景颜色?

html - float 不起作用,第二个背景图像未注册为背景,居中?

CSS 相对定位

css - 强制绝对定位的 div 不重叠

html - 工作灯 : BB9900 - Application launches by displaying splash screen for long duration

jquery - Bootstrap 选择样式和搜索不起作用

javascript - Owl Carousel 无法与 Bootstrap 一起正常使用