Dreamweaver 如何令一个层 居中?

来源:百度知道 编辑:UC知道 时间:2024/05/29 10:41:54
我打 怎么不行 代码要怎样写???
script language="javascript" type="text/javascript">
layer1.left=screen.width-70;
</script>
具体是怎样啊

首先你要给他设置一个宽度,然后在设置margin:0 auto;
例如<div style="width:800px;margin:0 auto">......</div>

哦,原来你的是一个浮动层...例如这样
<style type="text/css">
.pop{position:absolute;left:40%;top:40%;width:300px;height:100px;background:#eee;border:1px solid #ccc}
</style>

<div class="pop"></div>

其中left:40%;top:40%;这个数值需要根据你的层实际大小, 你自己去调整

用DIV,有个属性float

用css实现