2016-02-17 19 views
-2

這裏有點我的代碼段,我想爲我的網站結束2個不同的部分,但我不能這樣做。爲什麼引進和mainpart正在做只有一個HTML/CSS

也許是一個相關的問題,我正努力去理解這個區別。

有什麼建議嗎?

<!DOCTYPE html> 
<html> 
    <head> 
     <meta charset="utf-8"> 
     <title>Welcome Bootsworld</title> 
     <link rel="stylesheet" type="text/css" href="bootsworld.css"> 
    </head> 
    <body> 
    <div id="page" class="divborder"> 
      <header id="pageheader">  
       <nav id="primarynav"> 
        <ul> 
         <li><a href="#">Site map</a></li> 
         <li><a href="#">Privacy policy</a></li> 
         <li><a href="#">Accessibility</a></li> 
        </ul> 
       </nav> 
       <nav id="title"> 
        <h1>BOOT</h1><h2>WORLD</h2> 
       </nav> 
       <nav id="secondnav">    
        <ul> 
         <li><a href="#">HOME</a></li> 
         <li><a href="#">SHOP</a></li> 
         <li><a href="#">NEWS</a></li> 
         <li><a href="#">ABOUT US</a></li> 
         <li><a href="#">CONTACT US</a></li> 
         <li><a href="#">SUBSCRIBE</a></li> 
        </ul> 
       </nav> 
      </header> 
     <div id="introduction" class="divborder"> 
      <img src="boots.png" width="500" height="350" alt="boots"/> 
      <h2>Welcome to boot world</h2> 
      <p class="intro">BootWorld is the largest online footwear retailer in the UK.<a href="#">Our shop</a> always has stock of the latest designer footwear at the most competitive prices. Want to know more about us or our products, why <a href= "mailto:#">not send us a message.</a></p> 
     </div> 
     <div id="mainpart" class="divborder"> 
     <h2>NEW IN THE SHOP</h2> 
      <article class= "news"> 
       <h3>CLASSIC COWBOY BOOTS</h3> 
        <p>Stand out from the crowd in a pair of classic cowboy boots. Available for Ladies and Gents from only <mark class="black">£49.99</mark></p> 
       <h3>MILITARY BOOTS</h3> 
        <p>Hard-wearing Men's military boots, gsuaranteed to withstand all weathers. From only <mark class="black">£69.99</mark></p> 
       <h3>ROMAN SANDALS</h3> 
        <p>Get ready for summer with some stylish roman sandals. From only <mark class="black">£39.99</mark></p> 
       <h3>OFFICE SHOES</h3> 
        <p>You don't have to wear boring shoes to the office. Check out our new stock of Ladies and Gents fashionable office shoes from only <mark class="black">£44.99</mark></p> 
      </article> 


      <aside id="latestnews"> 
       <h3>Latest News</h3> 
        <p>Our seasonal sale has kicked off again! make sure you stop by our online shop to pick up a bargain.</p> 
        <footer>Posted by: Joe</footer> 

       <h3>Subscribe</h3> 
        <p>Sign up to our newsletter and receive exclusive offers by email weekly.</p> 
        <form> 
        <fieldset> 
         <legend>SIGN UP NOW!</legend> 
         <p> 
         <label for="yourname">Your name</label><br/> 
         <input type="text" name="yourname" id="yourname"size="20"/>  
         </p> 
         <p> 
         <label for="emailaddress">email address</label><br/> 
         <input type="text" name="emailaddress" id="emailaddress"size="20"/>  
         </p> 
         <button onclick="myFunction()">Sign Up</button> 
        </fieldset> 
        </form> 
      </aside> 
       </div>  
       </div>  
     <footer id="pagefooter"> 
      <h3>OUR ADDRESS:</h3> 
      <p>Malet Street,<br/> London, WC1E 7HX</p> 
     </footer> 
    </div>   
    </body> 
</html> 

這裏了CSS的更準確:

body{ 
    font-family: Arial, Verdana, Geneva, sans-serif; 
    width: 90%; 
    margin: auto; 
} 
h1,h2{ 
    display: inline; 
    color: #016008; 
} 
h1{ 
    font-size: 60px; 
} 
h2{ 
    font-size: 40px; 
} 
li{ 
    display: inline; 
} 
a{ 
    color:#016008; 
    text-decoration: none; 
} 
#secondnav a{ 
    color:#016008; 
    text-decoration: none; 
    background-color: #dddddd; 
    border: 1px; 
} 

aside{ 
    color:#016008; 
    text-decoration: none; 
    background-color: #dddddd; 
    float: right; 

} 
form{ 
    background-color: white; 
    margin: 0px; 
} 
legend{ 
    color: #3e3e3e; 
    font-weight: bold; 
} 
#primarynav ul{ 
    color: #016008; 
    text-align: right; 
} 
#secondnav{ 
    display: block; 
    text-align: justify; 
} 
#mainpart h2{ 
    color: #3e3e3e; 
} 
#latestnews h3{ 
    color: #3e3e3e; 
} 
#latestnews footer{ 
    float: right; 
    color: #3e3e3e; 
} 
#latestnews p{ 
    text-decoration: underline; 
} 
#suscribe h3{ 
    color: #3e3e3e; 
} 
#pagefooter{ 
    background-color: #dddddd; 
    color:#3e3e3e; 
} 
img{ 
    border:1px solid grey; 
    float: left; 
} 
#introduction{ 
    margin-top: 0px; 
    float: right; 
} 
.news{ 
    background-color: #dddddd; 
    width: 65%; 
    padding:2px 7px 4px 7px; 
    margin: 2px 2px 2px 2px; 
    text-align: justify; 
    color:#016008; 
} 
.divborder{ 
    border: 1px solid grey; 
    box-shadow: 1px; 
    margin: 10px; 
} 
div{ 
    text-align: justify; 

    padding:2px 7px 4px 7px; 
    margin: 10px; 
} 
#pagefooter{ 
    padding:2px 7px 4px 7px; 
} 
#latestnews{ 
    display: inline; 
    width:30%; 
} 
#suscribe{ 
    display: inline-block; 
    width:30%; 

} 
mark.black{ 
    color: black; 
    background: none; 
    font-weight: bold; 
} 
img{ 
    margin:10px; 
} 
#mainpart{ 
    background-color: blue; 
} 
+1

* 2個不同的部分,我的網站的結束,但我不能這樣做。*您能具體談談你想要什麼,你得到了什麼呢?如果這與你的CSS有關,你需要提供相關的類。 – BSMP

+0

我有2個部分我想添加在我的主要部分的權利。讓我發佈我的所有實際網頁。 –

回答

0

的CSS是非常的混亂和難以閱讀,但這裏是你的問題。首先,您不希望在您的h2商店中使用display: inline。擺脫你的aside浮動和給dispaly: inline-block#latestnews.news。從那裏你必須制定間距和定位,但是這會給你'兩個單獨的部分,以便你的網站結束。' CodePen

.news { 
    background-color: #dddddd; 
    width: 65%; 
    padding: 2px 7px 4px 7px; 
    margin: 2px 2px 2px 2px; 
    text-align: justify; 
    color: #016008; 
    display: inline-block; 
} 
#latestnews { 
    display: inline-block; 
    width: 30%; 
} 
aside { 
    color: #016008; 
    text-decoration: none; 
    background-color: #dddddd; 
    /* float: right; */ 
} 
相關問題