<body>
<div id="ma" class="main">
<div class="top"></div>
<div class="middle"></div>
<div class="bottom"></div>
</div>
</body>结构如上,里面的内容我就省略了,我现在的情况是网页滚到 横向有一块留白 这留白让我蛋疼了很久,想用js解决,希望大家帮个忙 今天下午我买的js书就能到了 我不知道怎么写
我的想法如下: 用document.getElementID(ma) 控制main那个div 然后在document.body.clientHeight获取网页高度, 但是我不知道怎么写啊 希望能帮忙写个规范的完整代码 因为没有老师 所以。。额我知道要先
<script type="text/javascript">
麻烦大家帮忙写一下
</script>
<div id="ma" class="main">
<div class="top"></div>
<div class="middle"></div>
<div class="bottom"></div>
</div>
</body>结构如上,里面的内容我就省略了,我现在的情况是网页滚到 横向有一块留白 这留白让我蛋疼了很久,想用js解决,希望大家帮个忙 今天下午我买的js书就能到了 我不知道怎么写
我的想法如下: 用document.getElementID(ma) 控制main那个div 然后在document.body.clientHeight获取网页高度, 但是我不知道怎么写啊 希望能帮忙写个规范的完整代码 因为没有老师 所以。。额我知道要先
<script type="text/javascript">
麻烦大家帮忙写一下
</script>
那段是我胡写的 无视就行了
没有这些文件我们也不知道你的效果
两种方法:
1:
再DIV中定义,属于内嵌样式 代码为:
<div id="mydiv" style= "height:50px;"></div>
这样就规定高度是50px;2:用css 不管是在页面还是引入:
<style type="text/css">
.mydiv{
height: 22px;
}
</style>两种均可。如果是js控制的话:
可以直接
var hir=document.getElementById("mydiv");
a.style.height.="50px";
*{
margin:0;
padding:0;
font-size:12px;
}
.main{
margin:auto;
margin-bottom:0px;
width:1000px;
height:100%;
background-color:#FFFFFF;overflow:hidden;margin-bottom:0px;
}body{
background-image:url(picture/bg_1.jpg);}.top{
width:930px;
height:135px;
margin-left:35px;}.logo{
width:930px;
height:100px;
margin:auto;
background-image:url(picture/logo_1.jpg);
float:left;
}.middle{
width:930px;
margin-left:35px;
margin-bottom:20px;
display:inline-block;}.bottom{
height:100px;
width:930px;
background-image:url(picture/bottom.jpg);
margin-left:35px;
margin-bottom:0px;
clear:both;}
dir.director{
margin:auto;
width:930px;
height:35px;
}
ul{
list-style:none;
}
li{
float:left;
position:relative;
}
table{
position:absolute;
top:0px;
left:0px;
}
.dir_cls{
display:block;
height:35px;
line-height:35px;
color:#993399;
text-decoration:none;
text-align:center;
background:url(picture/director.jpg);
}
a:hover{
color:#BD6B09;
cursor:hand;
}
li:hover .inside,
a:hover .inside{
display:block;
position:relative;
left:-2px;
top:0px;
background:#36F;
}
.inside{
display:none;
}
.inside span a{
background:FFFF99;
color:#000;
}
.inside span a:hover{
color:#FFF;
background:#36F;
}
other.subtitle{
width:930px;
height:50px;
margin-left:35px;
overflow:hidden;
}.left_otr{
font-size:24px;
font-family:"宋体";
color:#66CCFF;
text-align:left;
width:270px;
float:left;
margin-top:22px;
text-indent:24px;
}.right_otr{
float:left;
margin:auto;
width:660px;
}.left_om{
width:230px;
float:left;
margin:auto;
padding:15px 20px 10px;}.pt{
margin:auto;
margin-bottom:20px;
height:35px;
line-height:35px;
width:230px;
text-indent:30px;
}
.contact{
float:left;
width:210px;
font-size:14px;
font-family:"宋体";
color:#333333;
font-weight:600;
margin:20px auto 20px;
}.right_om{
width:660px;
float:left;
margin:auto;
}.otr_dir{
width:150px;
height:50px;
line-height:50px;
float:left;
margin:auto;
font-size:18px;
color:#FFCC33;
text-decoration:none;
background:url(picture/director.jpg);
text-align:center;
}.otr_d_out{
margin-bottom:20px;
float:left;
}li{
list-style:none;
}.otr_map{
margin:auto;
width:270px;
}.thumbnail{
position: relative;
z-index: 0;
}.thumbnail:hover{
background-color: transparent;
z-index: 50;
}.thumbnail span{ /*CSS for enlarged image*/
position: absolute;
background-color: lightyellow;
padding: 5px;
left: -1000px;
border: 1px dashed gray;
visibility: hidden;
color: black;
text-decoration: none;
}
.thumbnail span img{ /*CSS for enlarged image*/
border-width: 0;
padding: 2px;
}.thumbnail:hover span{ /*CSS for enlarged image on hover*/
visibility: visible;
top: -200;
left: 60px; /*position where enlarged image should offset horizontally */}
otherright
.ID6{
float:left;
margin-bottom:15px;
font-size:14px;
text-align:left;
}.ID66{
float:left;
margin:auto;
padding:10px;
color:#333333;
}#ID1{
margin:auto;
float:left;
width:620px;
}#ID1 p{
text-indent:20px;
font-size:22px;
color:#333333;
line-height:150%;
}.ID2{
width:620px;
margin:auto;
float:left;
border-bottom:#CCCCCC solid 2px;
color:#333333;
}.ID2_l{
width:200px;
text-align:center;
float:left;
line-height:100px;
}.ID2_r{
width:400px;
margin:auto;
float:left;
}.ID2_d{
width:580px;
margin-top:15px auto 15px;
padding:10px;
float:left;
line-height:150%;
font-size:14px;
}.ID22{
width:620px;
margin:auto;
float:left;
color:#333333;
}
.ID2_ll{
width:200px;
text-align:center;
float:left;
line-height:100px;
}.ID2_rr{
width:300px;
margin:auto;
float:left;
}.ID2_dd{
width:600px;
margin:20px auto 20px;
float:left;
font-size:20px;
line-height:150%;
}
.ID7_d{
width:580px;
margin:auto;
padding:10px;
float:left;
line-height:150%;
font-size:18px;
}
.ID7_l{
width:200px;
text-align:left;
text-indent:10px;
float:left;
line-height:100px;
margin:auto;
}
.ID4{
width:620px;
float:left;
margin:auto;
font-size:18px;
color:#666666;
line-height:150%;
color:#000000;
}.ID5{
width:620px;
float:left;
margin:auto;
font-size:20px;
color:#333333;
line-height:150%;
}
希望帮忙看下 谢了
朋友 是这样 我body没有高度 有内容填充的