怪!层设置不了高度!急! 在页面最外的层可以设置宽度但是高度却不起作用,不管我是设置高或矮,整个页面是使用浮动定位,这是什么问题?需要怎样解决?高手帮忙啊! 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 一般是不会有楼主所述情况的,有可能漏写了</div>吧!!也可设置自动撑开:<div style="overflow:visible;"> 没有的,那个层是最大的一个代码是这样子的 ://大层样式#all{ height:1000px; width:2200px;}.clearfix{ _height:1%; overflow:hidden;//将这个属性改为visible后也没有效果。}<div id="all" class="clearfix"> <!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></title></head><body><body><div id="divPage"> <div>内容3</div> <div>内容2</div> <div>内容1</div> <div>内容4</div> <div>内容6</div> <div>内容5</div> <div>内容7</div> <div>内容8</div> <div>内容9</div> <div>内容10</div> </div><input type=button value="上一页" onclick="pagegrid.showPrePage();"> <input type=button value="下一页" onclick="pagegrid.showNextPage();"><input type=button value="排 序" onclick="pagegrid.sort('asc');pagegrid.showPage()"> </body> <script> function $(sId){ return document.getElementById(sId);}// ---------------------------------------function $Tag(sTag,oParNode){ oParNode=oParNode?oParNode:document; return oParNode.getElementsByTagName(sTag);}// ---------------------------------------function PageGrid(oDiv,nPSize){ this.container=oDiv; this.curentpage=1; this.pagesize=nPSize; this.record=(function(){ var aEl=$Tag("div",oDiv); var i,nLen=aEl.length; var aResult=[]; for(i=nLen-1;i>=0;i--){ aResult.splice(0,0,{ value:aEl[i].innerHTML, object:oDiv.removeChild(aEl[i]) }); } return aResult; })(); this.pagecount=this.record.length%nPSize==0 ?parseInt(this.record.length/nPSize) :parseInt(this.record.length/nPSize)+1;}// ---------------------------------------PageGrid.prototype.sort=function(sOrderType){ this.record.sort(function(el1,el2){ if(sOrderType=="asc") return el1.value<el2.value?-1:1; else return el1.value<el2.value?1:-1; });}// ---------------------------------------PageGrid.prototype.showPageAt=function(nPage){ var oDocFrag=document.createDocumentFragment(); nPage=nPage<1?1:nPage; nPage=nPage>this.pagecount?this.pagecount:nPage; var nIndex=(nPage-1)*this.pagesize; var nLen=this.record.length; var count=0; while(this.container.childNodes[0]){ this.container.removeChild( this.container.childNodes[0] ); } while(nIndex<nLen&&count<this.pagesize){ oDocFrag.appendChild(this.record[nIndex].object); count++; nIndex++; } this.container.appendChild(oDocFrag); this.curentpage=nPage; }// ---------------------------------------PageGrid.prototype.showPage=function(){ this.showPageAt(this.curentpage);}PageGrid.prototype.showPrePage=function(){ if(this.curentpage>1){ this.curentpage-=1; this.showPage(); }}// ---------------------------------------PageGrid.prototype.showNextPage=function(){ if(this.curentpage<this.pagecount){ this.curentpage+=1; this.showPage(); }}// ---------------------------------------var pagegrid=new PageGrid($("divPage"),3);pagegrid.showPage();</script></html> clearfix这个有什么用?直接<div id="all"></div>不就行了? _height:1%;在IE6下只有1%,跟1000px差太远了吧! div中也用到了div,并且使用了float属性吗?像这样<div id='container'><div style='float:left;'></div><div style='float:left;'></div></div> <div id="all"><div >你的div</div><div style="clear:both;"></div>====加上这个div</div> 是的,_height:1%;这个属性要与不要是没有关系的。我刚已经试过了 已经解决了,是那个clearfix样式的问题,把他去掉就没有问题了,谢谢大家帮忙! 应该是标签没有匹配的问题,不一定是最外的div,也有可能是里面的div,仔细检查(可以先把内容去掉,然后一点一点加) 将15位身份证转换成18位 使用webbrower如何查看当前页面的源文件? 请问在网页上怎样调用客户端的邮件程序发送带附件的邮件 C#读取WAB格式到dataset中 asp.net + MYSQL5.0出错,帮忙看一下 求sql算法啊 [VB]ASPX中session的时间怎么设定,我用session.timeout=40控制时间好像不管用啊? 求救,一个javascript asp.net是跨平台的吗? vb中的request.cookies("cookiename") is Nothing是什么意思?用c#怎么表示? 插入数据库语句有个问题 三元运算符的问题
也可设置自动撑开:
<div style="overflow:visible;">
#all
{
height:1000px;
width:2200px;
}
.clearfix
{
_height:1%;
overflow:hidden;//将这个属性改为visible后也没有效果。
}<div id="all" class="clearfix">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<title></title>
</head>
<body>
<body>
<div id="divPage">
<div>内容3</div>
<div>内容2</div>
<div>内容1</div>
<div>内容4</div>
<div>内容6</div>
<div>内容5</div>
<div>内容7</div>
<div>内容8</div>
<div>内容9</div>
<div>内容10</div>
</div>
<input type=button value="上一页" onclick="pagegrid.showPrePage();">
<input type=button value="下一页" onclick="pagegrid.showNextPage();">
<input type=button value="排 序" onclick="pagegrid.sort('asc');pagegrid.showPage()">
</body>
<script>
function $(sId){
return document.getElementById(sId);
}
// ---------------------------------------function $Tag(sTag,oParNode){
oParNode=oParNode?oParNode:document;
return oParNode.getElementsByTagName(sTag);
}
// ---------------------------------------function PageGrid(oDiv,nPSize){
this.container=oDiv;
this.curentpage=1;
this.pagesize=nPSize;
this.record=(function(){
var aEl=$Tag("div",oDiv);
var i,nLen=aEl.length;
var aResult=[];
for(i=nLen-1;i>=0;i--){
aResult.splice(0,0,{
value:aEl[i].innerHTML,
object:oDiv.removeChild(aEl[i])
});
}
return aResult;
})();
this.pagecount=this.record.length%nPSize==0
?parseInt(this.record.length/nPSize)
:parseInt(this.record.length/nPSize)+1;
}
// ---------------------------------------PageGrid.prototype.sort=function(sOrderType){
this.record.sort(function(el1,el2){
if(sOrderType=="asc")
return el1.value<el2.value?-1:1;
else
return el1.value<el2.value?1:-1;
});
}
// ---------------------------------------PageGrid.prototype.showPageAt=function(nPage){
var oDocFrag=document.createDocumentFragment();
nPage=nPage<1?1:nPage;
nPage=nPage>this.pagecount?this.pagecount:nPage;
var nIndex=(nPage-1)*this.pagesize;
var nLen=this.record.length;
var count=0;
while(this.container.childNodes[0]){
this.container.removeChild(
this.container.childNodes[0]
);
}
while(nIndex<nLen&&count<this.pagesize){
oDocFrag.appendChild(this.record[nIndex].object);
count++;
nIndex++;
}
this.container.appendChild(oDocFrag);
this.curentpage=nPage;
}
// ---------------------------------------PageGrid.prototype.showPage=function(){
this.showPageAt(this.curentpage);
}PageGrid.prototype.showPrePage=function(){
if(this.curentpage>1){
this.curentpage-=1;
this.showPage();
}
}
// ---------------------------------------PageGrid.prototype.showNextPage=function(){
if(this.curentpage<this.pagecount){
this.curentpage+=1;
this.showPage();
}
}
// ---------------------------------------var pagegrid=new PageGrid($("divPage"),3);
pagegrid.showPage();
</script></html>
像这样
<div id='container'>
<div style='float:left;'>
</div>
<div style='float:left;'></div>
</div>
<div >
你的div
</div><div style="clear:both;"></div>====加上这个div
</div>
是的,_height:1%;这个属性要与不要是没有关系的。我刚已经试过了
应该是标签没有匹配的问题,不一定是最外的div,也有可能是里面的div,仔细检查(可以先把内容去掉,然后一点一点加)