html - 将 Div 对齐到右下角

标签 html css

我有两个元素想放在页面的右下角。我经历了几个主题,但有些部分有帮助,而其他部分往往会破坏布局。

注意:背景色仅供说明之用。我希望文本右对齐。

这是我所在的位置:( http://jsfiddle.net/dsri/WswG9/ )

HTML:

<div id="container">
<div id="a"> <span id="aa">Text1</span></div>
<div id="b"> <span id="bb">Text2</span></div>
</div>

CSS:

div#container{
text-align: center;    
}
span#aa{
font-size: 75px;
color: rgba(0, 0, 0, 0.5);
background-color: Yellow;
overflow: hidden;
}
span#bb{
font-size: 45px;
color: rgba(0,0,0,0.5);
background-color: red;   
} 

这是我理想中想要的: http://i.imgur.com/ANuAvly.png

最佳答案

尝试将 #container div 的 CSS 更改为:

div#container {
    text-align: right;
    position:absolute;
    right:0;
    bottom:0;
}

jsFiddle example

关于html - 将 Div 对齐到右下角,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/18690841/

相关文章:

javascript - IntelliJ 14 使用 JS 和 CSS 查找用法/重构

javascript - bootstrap - 保持 div 固定在水平滚动条上

html - Twitter Bootstrap 3 中按钮组之间的水平分隔线

用于在 ie7 中将选择元素的背景设置为透明的 css

javascript - 使用 google Recaptcha 形式的 undefined variable ?

css - IE8/7 中的抗锯齿图像。我有哪些选择?

html - 如何制作侧面导航栏并让 div 填充其余空间

css - bootstrap 4 等效于表单控制反馈

css - 删除/重置 CSS 行为属性

html - 为什么 css 边距不起作用?