How do I align a div at the bottom right corner of a web page even if the content is less?

时光总嘲笑我的痴心妄想 提交于 2019-12-04 07:55:40

Try this solution:

* { margin: 0; }
html, body { height: 100%; }
/* the bottom margin is the negative value of the footer's height */
.wrapper { min-height: 100%; height: auto !important; height: 100%; margin: 0 auto -142px; }
/* .push must be the same height as .footer */
.footer, .push { height: 142px; }

found here

EDIT: too late to remember how to do it or to explain it, but if you need more help search google for "sticky footer"

Something slightly different but equally useful for you might be:

position: fixed;
bottom: 0;
right: 0;

This will keep your div in the bottom right corner of the screen at all times and content will flow behind it (somewhat similar to background-attachment: fixed;). Maybe not exactly what you're looking for, but definitely easier than some of the other hacks out there. Note that this won't work in IE6.

I stumbled across this thread while trying to figure out how to align a table to the lower right of a web page I'm using as the background for my browser. I used the position:absolute for the table, nested in a div, but aligned it from the other direction. Here is how the CSS looks:

    div 
        text-align:center

    table 
        position:absolute;
        top:63%;
        left:80%;
        text-align:left;
        background:rgba(0,0,0,0.4);

Afterwards, it was a matter of playing with the table width in HTML to get it where I wanted it to be. I hope this helps anyone looking to do the same thing - and thank you to the OP and those who took the time to answer the OP's question and thus my own :-)

Here is a link to a screenshot I took of the browser / desktop. You'll notice the table is in the lower right of the browser's background, but not directly on the edges.

Try using position: absolute along with javascripts screen.height.

Don't think it's the best solution but it worked for me a while ago. Probably this can be achieved even better with jQuery, but I didn't try it.

Using JavaScript : get your screen height, then dynamically create your or whatever, then

position:absolute;
top:<your document height>

Should put your div at the bottom. Do the same for right alignment. Though, i can't guarantee result on all browser.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!