**CSS**
@charset "utf-8";
@import 'https://fonts.googleapis.com/css?family=Alegreya+Sans';
/* CSS Document */
*{
\t margin: 0;
\t padding: 0;
\t border: 0;
}
body{
\t background: #EFEFEF;
\t color: black;
\t font-family: Cambria, Hoefler Text, Liberation Serif, Times, Times New Roman, serif;
\t margin: 0;
}
header{
\t width: 100%;
\t background: rgba(10,37,195,0.76);
\t height: 50px;
}
#header-inner{
\t max-width: 1200px;
\t margin: 0 auto;
}
nav{
\t float: right;
\t padding: 10px 0;
}
#menu-icon{
\t height: 40px;
\t width: 40px;
\t display: hidden;
\t background: url(../img/NAV.png) no-repeat center;
}
ul{
\t list-style-type: none;
}
nav ul li{
\t font-family: 'Alegreya Sans', sans-serif;
font-size: 150%;
display:inline-block;
float: left;
padding: 10px;
}
nav ul li a{
\t text-decoration: none;
\t color:aliceblue;
}
nav ul li a:hover{
\t color: rgba(208,208,208,0.90);
}
/*---end navbar---*/
#banner{
\t width: 100%;
\t height: 200px;
}
#banner-inner{
\t width: 100%;
\t height: 50vw;
}
/*------media----*/
@media screen and (max-width: 768px){
header{
position: absolute;
}
#logo{
margin: 15px 0 20px -25px;
background: url(img/RD_mobile.png) no-repeat center;
}
#menu-icon{
display: inline-block;
}
nav ul, nav:active ul{
display: none;
z-index: 1000;
position: absolute;
padding: 20px;
background: #6991AC;
right: 50px;
top: 60px;
border: 1px solid #FFF;
border-radius: 10px 0 10px 10px;
width: 50%;
}
nav:hover ul{
display: block;
}
nav li{
text-align: center;
width: 100%;
padding: 10px 0;
\t }
}
**HTML**
<!DOCTYPE html>
<html>
<head>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link rel="stylesheet" href="style/homecss.css">
</head>
<body>
<header>
<div id="hearder-inner">
<a href="home.html" id="logo"></a>
<nav>
<a href="#" id="menu-icon"></a>
<ul>
<li><a href="home.html" class="current">Home</a></li>
<li><a href="#" >About</a></li>
\t \t \t \t \t <li><a href="#" >Gallery</a></li>
</ul>
</nav>
</div>
</header>
<!---ending header-->
<section id="banner">
\t <img id="banner-img" src="img/20140505211825_YY8Un.jpeg">
</section>
</body>
</html>
一旦我想補充的CSS,每當頭滿足了媒體的顏色會變成暗的條件媒體。我不明白。我只在標題上添加一種顏色,爲什麼它會在導航欄變小時變成第二種顏色?
感謝您的回答。我將職位的價值改變爲親戚,問題解決了。有很多關於建立網絡的技巧。我非常感謝你的幫助。我剛開始學習和建立一個網站。 –
沒問題@TroyWu和快樂編碼;) –