在使用DIV + CSS的底部对齐按钮按钮、DIV、CSS

2023-09-11 07:36:26 作者:跟过去道个别

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

DIV的CSS的:

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

解决方案

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

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

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

 的位置是:绝对的;
右:0;
底部:0;
 
css div居中显示

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;