2014-10-16 75 views
0

我想将breadcrumb div加入到标题和左侧栏div中,附上image关闭div与CSS之间的差距

而且我想让内容div覆盖整个页面 - 目前它只覆盖内容div的3/4。 (我不能previous answers或谷歌搜索实现这个...)

HTML代码:

<div> <!-- container --> 

      <div id="header"> 
       <h1 align="center">Dashboard</h1> 
      </div> 

      <div id="nav"> 
       Networks<br> 
       Data Management<br> 
       Assets<br> 
      </div> 

      <div id="section"> 
      <div id="content-header"> 
       <h6 align="left">Breadcrumb</h6> 
      </div> 
      <h2>London</h2> 
      <p> 
       London is the capital city of England. It is the most populous city in the United       Kingdom, 
     with a metropolitan area of over 13 million inhabitants. 
      </p> 
      <p> 
     Standing on the River Thames, London has been a major settlement for two millennia, 
     its history going back to its founding by the Romans, who named it Londinium. 
      </p> 

    </div> 

</div> <!-- /container --> 

CSS代码:

#header { 
     background-color:#fecb00; 
     color:white; 
     text-align:center; 
     padding:5px; 
     } 
    #nav { 
     line-height:30px; 
     background-color:#002244; 
     color:white; 
     height:819px; 
     width:200px; 
     float:left; 
     padding:5px; 
    } 
    #section { 
     min-height: 100%; 
     width: auto; 
     float:left; 
     padding:10px;   
    } 

    #content-header { 
     background-color:#747678; 
     color:white; 
     text-align:center; 
     padding:5px; 
    } 
+0

您不能在StackOverflow上两次提出相同的问题。另一方面,请在JSFiddle或StackOverflow代码片段中记下您的CSS/HTML/JS代码。 – 2014-10-16 14:12:50

+0

谢谢@ WissamEl-Kik,将从下次把代码放入JSFiddle – 2014-10-16 14:15:34

回答

2

我放在你的#content-header以外的#section DIV和似乎解决了这个问题

jsfiddle

发生此问题的原因是您的#section div具有10像素的填充,导致您的面包屑移动。

+1

非常感谢! @Azrael,它的工作,再次非常感谢你,从早上开始一直在尝试,现在我明白了,谢谢 – 2014-10-16 14:21:03

+0

哈哈@欢迎你@Java.beginner和那个身高,试着在你的css中做这个:'计算(100%像素)'其中像素将是您的标题+面包屑的高度。 – Azrael 2014-10-16 14:23:33

1

这是你想要的吗?

我掏出填充,增加了宽度

#header { 
 
     background-color:#fecb00; 
 
     color:white; 
 
     text-align:center; 
 
     padding:5px; 
 
     } 
 
    #nav { 
 
     line-height:30px; 
 
     background-color:#002244; 
 
     color:white; 
 
     height:819px; 
 
     width:200px; 
 
     float:left; 
 
     padding:5px; 
 
    } 
 
    #section { 
 
     min-height: 100%; 
 
     width: 84%; 
 
     float:left; 
 
     /*padding:10px; */  
 
    } 
 

 
    #content-header { 
 
     background-color:#747678; 
 
     color:white; 
 
     text-align:center; 
 
     padding:5px; 
 
    }
<div> <!-- container --> 
 

 
      <div id="header"> 
 
       <h1 align="center">Dashboard</h1> 
 
      </div> 
 

 
      <div id="nav"> 
 
       Networks<br> 
 
       Data Management<br> 
 
       Assets<br> 
 
      </div> 
 

 
      <div id="section"> 
 
      <div id="content-header"> 
 
       <h6 align="left">Breadcrumb</h6> 
 
      </div> 
 
      <h2>London</h2> 
 
      <p> 
 
       London is the capital city of England. It is the most populous city in the United       Kingdom, 
 
     with a metropolitan area of over 13 million inhabitants. 
 
      </p> 
 
      <p> 
 
     Standing on the River Thames, London has been a major settlement for two millennia, 
 
     its history going back to its founding by the Romans, who named it Londinium. 
 
      </p> 
 

 
    </div> 
 

 
</div> <!-- /container -->

+0

感谢@Lemuel Botha,它的工作,感谢您的时间和帮助 – 2014-10-16 14:22:30

1

解决办法很简单:

你不能有width:auto这里

#section { 
min-height: 100%; 
width: auto; 
float:left; 
padding:10px;   
} 

所以改变它为af ixed width% width,如下所示:

#section { 
    min-height: 100%; 
    width: 71%; /* adjust the width according to your needs */ 
    float:left; 
    padding:10px;   
} 
+0

谢谢@dippas,它的工作,非常感谢你... – 2014-10-16 14:23:05