在页面最外的层可以设置宽度但是高度却不起作用,不管我是设置高或矮,整个页面是使用浮动定位,这是什么问题?需要怎样解决?高手帮忙啊!

解决方案 »

  1.   

    一般是不会有楼主所述情况的,有可能漏写了</div>吧!!
    也可设置自动撑开:
    <div style="overflow:visible;">
      

  2.   

    没有的,那个层是最大的一个代码是这样子的 ://大层样式
    #all
    {
       height:1000px;
       width:2200px;
    }
    .clearfix
    {
       _height:1%;
       overflow:hidden;//将这个属性改为visible后也没有效果。
    }<div id="all" class="clearfix">
      

  3.   

    <!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>
      

  4.   

    clearfix这个有什么用?直接<div id="all"></div>不就行了?
      

  5.   

    _height:1%;在IE6下只有1%,跟1000px差太远了吧!
      

  6.   

    div中也用到了div,并且使用了float属性吗?
    像这样
    <div id='container'>
    <div style='float:left;'>
    </div>
    <div style='float:left;'></div>
    </div>
      

  7.   

    <div id="all">
    <div >
    你的div
    </div><div style="clear:both;"></div>====加上这个div
    </div>
      

  8.   


    是的,_height:1%;这个属性要与不要是没有关系的。我刚已经试过了
      

  9.   

    已经解决了,是那个clearfix样式的问题,把他去掉就没有问题了,谢谢大家帮忙!
      

  10.   


    应该是标签没有匹配的问题,不一定是最外的div,也有可能是里面的div,仔细检查(可以先把内容去掉,然后一点一点加)