![](/img/trans.png)
[英]Make div on left side fill screen width based on screen width and with an offset to the center
[英]Center a div on the left side of the screen
使用顶部和左侧。
#wrapper {
left: 50%;
position: absolute;
margin-left: -223px /* half of width*/
}
然后使用以下方法对div进行动画处理:
$('button[name="whattoput"]').click(function () {
$('div').animate({
left: "323px" // target position + left margin
});
});
检查一下,请将#wrapper的位置相对
.hidestuff {
//display: none;
}
#wrapper {
margin-left:auto;
margin-right:auto;
width: 445px;
position:relative;
}
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.