2017-08-13 39 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

太棒了!請將此答案標記爲已解決:-) –