将 Div 与右下角对齐



我有两个元素想放在页面的右下角。我经历了几个线程,但有些部分有帮助,而另一些则倾向于杀死布局。

注意:背景颜色仅用于说明目的。我希望文本向右对齐。

这是我所在的地方:(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;   
} 

这是我理想中想要的:https://i.stack.imgur.com/GYZQI.png

尝试将 #containerdiv 的 CSS 更改为:

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

js小提琴示例

试试这个

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

像这样: http://jsfiddle.net/dsri/WswG9/?

div#container{
}
div#a,div#b{
text-align:right;
margin: 0 100px;
}

试试这个CSS

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

JSFIDDLE 链接

最新更新