【发布时间】:2014-10-25 01:26:01
【问题描述】:
我是一个新手,正在制作一个可爱的网站。我现在已经弄清楚如何使用漂亮的导航栏设置整个主页。现在我想开始链接到一些不错的子页面。我设置了链接,一切正常,但我对如何将 CSS 从主索引页面分离到子页面感到非常困惑。
例如,主页上有一个漂亮的棕榈树的 jumbotron CSS。但我希望子页面具有相同的 CSS 技巧,背景中有一堆热带水果。然后另一个页面有另一个背景。我觉得我在这里遗漏了一些非常基本的东西,但我现在确定如何将 CSS 从我的索引页面与我想要不同 CSS 的子页面分开。我什至不确定要问什么问题,因为我一直在谷歌上搜索,而且我还没有走远。
基本上,我如何将主页面上的设计与子页面分开?
html {
background: url(../images/mexicobeach.jpg) no-repeat center center fixed;
-webkit-background-size: cover;
-moz-background-size: cover;
-o-background-size: cover;
background-size: cover;
}
h1 {
font-family: 'Sansita One', cursive;
font-size: 82px;
text-align: center;
margin: 60px 0 0 0;
}
h2 {
font-family: 'Sansita One', cursive;
font-size: 120px;
text-align: center;
margin: 60px 0 0 0;
}
.nav {
position:fixed;
bottom:0px;
left: 0;
font-family: 'Sansita One', cursive;
width:100%;
height:50px;
padding: 0px;
text-align: center;
}
ul {
padding: 10px;
background: rgba(8, 102, 112, 0.5);
}
li {
display: inline;
padding: 10px 20px 0px 30px;
}
a {
color: white;
}
<!DOCTYPE html>
<head>
<link rel="stylesheet" type="text/css" href="css/mexicostylesheet.css" />
<link href='http://fonts.googleapis.com/css?family=Sansita+One' rel='stylesheet' type='text/css'>
<title>Smithies in Mexico</title>
<style>
</style>
</head>
<body>
<div class="nav">
<div class="container">
<ul id="navigation">
<li><a href="subpageabout.html">About</a></li>
<li><a href="subpageschedule.html">Schedule</a></li>
<li><a href="subpagestay.html">Stay</a></li>
<li><a href="subpagedo.html">Do</a></li>
<li><a href="subpageeat.html">Eat</a></li>
<li><a href="subpagemexicanmadlibs.html">Mexican Mad Libs</a></li>
<li><a href="subpagetacogame.html">Taco Game</a></li>
<li><a href="subpagecountdown.html">Countdown</a></li>
<li><a href="subpagequiz.html">Quiz</a></li>
</ul>
</div>
</div>
<div class="jumbotron"
<div class="container">
<h1>Smith Ladies Go To</h1>
<h2>Mexico</h2>
</div>
</div>
</div>
</body>
【问题讨论】:
-
在“href”属性中使用不同的值来链接文件中的另一个样式表,,给你可以了解更多,w3schools.com/tags/tag_link.asp