2017-03-16 10 views
1

したがって、ナビゲーションバーをコンテンツボックスと同じサイズにします。しかし、異なるディスプレイ上でナビゲーションサイズが変化し、歪んだ場合。私はそれは同じサイズに滞在するためにすべてのものを試してみましたが、私はできませんCSSナビゲーションバーのサイズが変更されます

HTMLコーディング -

body { 
 
    background-color: rgb(229, 178, 146); 
 
} 
 

 
ul.navigation { 
 
    list-style-type: none; 
 
    margin: 0; 
 
    padding: 0; 
 
    overflow: hidden; 
 
    border: 1px solid; 
 
    background-color: #333; 
 
    width: 80%; 
 
} 
 

 
li a { 
 
    display: block; 
 
    color: white; 
 
    text-align: center; 
 
    padding: 20px 103.8px; 
 
    text-decoration: none; 
 
    float: left; 
 
} 
 

 
li a:hover { 
 
    background-color: #FFF; 
 
    color: #000; 
 
} 
 

 
.active { 
 
    background-color: #000; 
 
} 
 

 
div.content { 
 
    background-color: #FFF; 
 
    width: 80%; 
 
    height: 100%; 
 
    margin: -22; 
 
} 
 

 
div.footer { 
 
    background-color: #333; 
 
    text-align: center; 
 
    overflow: hidden; 
 
    color: white; 
 
    border: solid; 
 
    width: 100%; 
 
    padding: 0%; 
 
    margin auto; 
 
} 
 

 
hr { 
 
    border: 1px solid; 
 
    border-color: #FFF 
 
} 
 

 
h1 { 
 
    text-align: center; 
 
    color: grey; 
 
}
<!DOCTPYE HTML> 
 
<html> 
 

 
<head> 
 
    <title>Shahed's Portfolio</title> 
 
    <link rel="stylesheet" type="text/css" href="css/site.css" /> 
 
</head> 
 

 
<body> 
 
    <hr/> 
 
    <h1>Shahed Miah's Portfolio</h1> 
 
    <hr/> 
 
    <center> 
 
    <ul class="navigation"> 
 
     <li><a class="active" href="home.html">Home</a></li> 
 
     <li><a href="about.html">About</a></li> 
 
     <li><a href="projects.html">Projects</a></li> 
 
     <li><a href="contact.html">Contact</a></li> 
 
    </ul> 
 

 
    <div class="content"> 
 
     <h1>Home</h1> 
 
     <p>What is Lorem Ipsum? Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make 
 
     a type specimen book. It has survived not only five centuries, but also the leap into electronic typesetting, remaining essentially unchanged. It was popularised in the 1960s with the release of Letraset sheets containing Lorem Ipsum passages, 
 
     and more recently with desktop publishing software like Aldus PageMaker including versions of Lorem Ipsum.</p> 
 
    </div> 
 
    </center><br/> 
 

 
    <div class="footer"> 
 
    <p>Copyright &copy;Shahed Miah</p> 
 
    </div> 
 

 

 
</body> 
 

 
</html>

+0

使用のブートストラップコンテナ –

+0

彼/彼女はブートストラップを使用していません... –

答えて

1

変更CSS

body { 
    background-color: rgb(229, 178, 146); 
} 
ul.navigation { 
    list-style-type: none; 
    margin: 0; 
    padding: 0; 
    overflow: hidden; 
    border: 1px solid; 
    background-color: #333; 
    width: 80%; 


} 
li{float: left; 
    width: 25%;} 
li a { 
    display: block; 
    color: white; 
    text-align: center; 
    padding: 20px 0; 
    text-decoration: none; 

} 

li a:hover { 
    background-color: #FFF; 
    color: #000; 
} 
.active { 
    background-color: #000; 
} 
div.content { 
    background-color: #FFF; 
    width: 80%; 
    height: 100%; 
    margin: -22px; 

} 
div.footer { 
    background-color: #333; 
    text-align: center; 
    overflow: hidden; 
    color: white; 
    border: solid; 
    width: 100%; 
    padding: 0%; 
    margin auto; 
} 
hr { 
    border: 1px solid; 
    border-color: #FFF 
} 
h1 { 
    text-align: center; 
    color: grey; 
} 

https://jsfiddle.net/LLk9a8fq/

+0

grrr .. faster:P –