2017-08-13 40 views
0

我试图在整个网页上放一个黑框。把父div放在整个网页上

我希望父div可以围绕整个页面,而不仅仅是底部。我的HTML看起来像这样:

<body> 
<!-- Header --> 
     <section id = "top" class = "top"> 
      <div class="container"> 
       <h1 class = text-center>Sarah Hynds</h1> 
      </div> 
     </section> 
     <!------ tabs ------> 
     <nav class="mynav"> 
      <ul> 
       <li> 
        <a href="">About</a> 
       </li> 
       <li> 
        <a href="">Resume</a> 
       </li> 
       <li> 
        <a href="">Projects</a> 
       </li> 
       <li> 
        <a href="">Interests</a> 
       </li> 
       <li> 
        <a href="">Contact</a> 
       </li> 
      </ul> 
     </nav> 
     <hr id="separator" width="35%" color="black"> 
     <div class="floating-box" id="about"></div> 
     <div class=floating-box" id="profile"> 
     </div> 
     <div class="parentDiv"></div> 
</body> 

我的CSS是这样的:

.parentDiv { 
width: 90%; 
border: 1px solid #000000; 
margin-top: 5%; 
margin-left: 5%; 
margin-right: 5%; 
height: 100%; 
display: inline-block; 
padding-bottom: 50px; 
display: inline-block; 
white-space: nowrap; } 

我怎样才能把边框整个页面各处? 非常感谢!

+1

难道你只是把''标签的边框? – Ginkoid

+0

就像这样:'body border-style:solid; border-width:5px; border-radius:10px; } ' – Ginkoid

+0

该div没有结束标记 –

回答

0
<body> 
<div class="parentDiv"> 
<!-- Header --> 
     <section id = "top" class = "top"> 
      <div class="container"> 
       <h1 class = text-center>Sarah Hynds</h1> 
      </div> 
     </section> 
     <!------ tabs ------> 
     <nav class="mynav"> 
      <ul> 
       <li> 
        <a href="">About</a> 
       </li> 
       <li> 
        <a href="">Resume</a> 
       </li> 
       <li> 
        <a href="">Projects</a> 
       </li> 
       <li> 
        <a href="">Interests</a> 
       </li> 
       <li> 
        <a href="">Contact</a> 
       </li> 
      </ul> 
     </nav> 
     <hr id="separator" width="35%" color="black"> 
     <div class="floating-box" id="about"></div> 
     <div class=floating-box" id="profile"> 
     </div> 

</div> 
</body> 
</html> 

只是简单地将它包裹在你想要影响的内容上。 :-)

+0

谢谢,修正了这个问题! –

+0

太棒了!请将此答案标记为已解决:-) –