我的 CSS 有问题。
在主页上它加载正常,但是当我转到我网站上的链接时,css 无法正确加载。所以基本上下面的代码在 index.html 上可以正常工作,但是当我转到下面指示的任何链接时,它就会出错。
所有链接都有完全相同的代码,所以我不明白为什么它不起作用。
这是我的源代码:
<!--
To change this template, choose Tools | Templates
and open the template in the editor.
-->
<!DOCTYPE html>
<html>
<head>
<title></title>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<LINK href="styles.css" rel="stylesheet" type="text/css">
</head>
<body>
<div id ="leftcol">
<a href="content/practice.html"><div class ="left-column-item">Practice!</div></a>
<a href="content/AboutUs.html"><div class ="left-column-item">About Us!</div></a>
<a href="content/contactUs.html"><div class ="left-column-item">Contact Us!</div></a>
</div>
<div id="left-placeholder"></div>
<div id ="left-pusher"></div>
<div id ="content">Math Practice Site <br> hello</div>
</body>
</html>
//the css file:
/*
Document : styles
Created on : Nov 2, 2012, 11:50:48 PM
Author : me
Description:
Purpose of the stylesheet follows.
*/
root {
display: block;
}
#leftcol a{text-decoration: none;}
#leftcol{
left: 10%;
width: 200px;
height: 100%;
margin-top: 0px;
position: absolute;
opacity:0.6;
color: white;
font-size: 2em;
}
#left-placeholder{
height: 100%;
width: 10%;
float: left;
}
#left-pusher{
height: 100%;
width: 200px;
float: left;
}
.left-column-item{
background: url('images/bgnav.jpg');
height: 33.334%;
background-size: 100%;
opacity:0.6;
color: white;
}
.left-column-item:hover{
background: url('images/bgnav.jpg');
height: 33.334%;
background-size: 100%;
opacity: 1;
}
#content{
text-align: center;
color: white;
font-size: 5em;
height: 100%;
width: 70%;
float:left;
}
body{
background: url('images/background.jpg');
background-size: 100%;
margin: 0;
min-height: 100%;
width: 100%}
html, body
{
height: 100%;
}
这是我的练习页面:
<!DOCTYPE html>
<html>
<head>
<title></title>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<LINK href="../styles.css" rel="stylesheet" type="text/css">
<script type ="text/javascript">
</script>
</head>
<body>
<div id ="leftcol">
<a href="practice.html"><div class ="left-column-item">Practice!</div></a>
<a href="aboutUs.html"><div class ="left-column-item">About Us!</div></a>
<a href="contactUs.html"><div class ="left-column-item">Contact Us!</div></a>
</div>
<div id="left-placeholder"></div>
<div id ="left-pusher"></div>
<div id ="content">Practice!</div>
</body>
</html>