在使用DIV + CSS的底部对齐按钮 [英] Align button at the bottom of div using CSS

查看:159
本文介绍了在使用DIV + CSS的底部对齐按钮的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我要调整我的按钮,我div的右下角。我该怎么办呢?

DIV的CSS的:

 浮动:权利;
    宽度:83%;
    保证金右:0px;
    字体-family:宋体,黑体,无衬线;
    字体大小:12px的;
    高度:625px;
    溢出:汽车;
 

解决方案

您可以使用的位置是:绝对的; 绝对父div中定位的元素。 当使用的位置是:绝对的; 元素将是绝对的第一定位的父格位置,如果找不到的话,会完全定位在窗口,所以你需要以确保内容的div被定位

为了使内容的div定位,所有的位置值不是静态的工作,但相对是因为它的最简单的本身不改变的div定位

所以添加的位置是:相对; 的内容DIV,从按键上移开浮动,并添加以下CSS到按钮:

 的位置是:绝对的;
右:0;
底部:0;
 

I want to align my button at the bottom right corner of my div. How can I do that?

Current css of div:

    float: right;
    width: 83%;
    margin-right: 0px;
    font-family: Arial, Helvetica, sans-serif;
    font-size: 12px;
    height:625px;
    overflow:auto;

解决方案

You can use position:absolute; to absolutely position an element within a parent div. When using position:absolute; the element will be positioned absolutely from the first positioned parent div, if it can't find one it will position absolutely from the window so you will need to make sure the content div is positioned.

To make the content div positioned, all position values that aren't static will work, but relative is the easiest since it doesn't change the divs positioning by itself.

So add position:relative; to the content div, remove the float from the button and add the following css to the button:

position: absolute;
right:    0;
bottom:   0;

这篇关于在使用DIV + CSS的底部对齐按钮的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆