js怎么让div始终靠窗体右下角

bufan2162 2010-03-28 06:09:32
js怎么让div始终靠窗体右下角 ,随着最大/小化,即使拉动窗体的宽度也不变。怎么实现,哥哥姐姐们?
...全文
276 6 打赏 收藏 转发到动态 举报
AI 作业
写回复
用AI写文章
6 条回复
切换为时间正序
请发表友善的回复…
发表回复
pswozaics007 2010-06-23
  • 打赏
  • 举报
回复
sdfsdfdsfds
bufan2162 2010-03-29
  • 打赏
  • 举报
回复
谢了1楼兄弟, bottom:2px; right:2px; 这两个样式是关键。
passself 2010-03-28
  • 打赏
  • 举报
回复
用document.body.clientWidth document.body.clientHeight来计算页面的高和宽,
shan1119 2010-03-28
  • 打赏
  • 举报
回复
css就可以了,没必要用js,
style="border:1px;bottom:1px;right:1px"
沫沫金 2010-03-28
  • 打赏
  • 举报
回复
position:[fixed];属性值更改为[absolute]
认真为自己 2010-03-28
  • 打赏
  • 举报
回复

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<title>test</title>
<style>
html {background:#ccc;}
body {margin:0; padding:0 10px 0 10px; border:0; height:100%; overflow:auto; background:#ccc;}
body {font-family: georgia, serif; font-size:12px;}
#menu {display:block; bottom:2px; right:2px; width:130px; position:fixed; border:1px solid #990000; padding:10px; text-align:center; font-weight:bold; color:#990000; background:#fff;}
* html #menu {position:absolute;}/*only for ie*/
</style>
<!--[if IE 6]> <style type="text/css"> /*<![CDATA[*/ html {overflow-x:auto; overflow-y:hidden;} /*]]>*/ </style><![endif]-->
</head>
<body>
<div style="background-color:#aa1234;width:200px;height:1000px">
<div id="menu">容器</div>
</div>
<div style="height:2000px;">2</div>
</body>
</html>

87,996

社区成员

发帖
与我相关
我的任务
社区描述
Web 开发 JavaScript
社区管理员
  • JavaScript
  • 无·法
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧