我正在使用背景图片和一些链接/图片在基本网站上工作。我的背景图像css代码中似乎有一个错误,因为当我删除它时,链接突然起作用。我尝试过使用css,但要么删除链接,要么删除背景图像。我在网站上搜索过但无法找到答案?
我的HTML:
<!DOCTYPE html>
<html>
<head>
<link rel="stylesheet" type="text/css" href="styles/stylec.css">
<title>About Joshua Taylor</title>
</head>
<div id="backgroundimage"></div>
<h2>Welcome to my page</h2>
<body>
<nav>
<ul class="nav">
<li>
<a href="index.html">About Me</a>
</li>
<li>
<a href="../htmlfirstpage/newsexample.html">Recommended Articles
</a>
</li>
<li>
<a href="../htmlfirstpage/mywork.html">My Work</a>
</li>
<li>
<a href="../htmlfirstpage/contact.html">Contact</a>
</li>
</ul>
</nav>
</body>
</html>
我的CSS:
html
{
background: url(../images/urban.jpg) no-repeat center center fixed;
-webkit-background-size: cover;
-moz-background-size: cover;
-o-background-size: cover;
background-size: cover;
}
#backgroundimage {
position: fixed;
top: -50%;
left: -50%;
width: 200%;
height: 200%;
}
#backgroundimage img {
position: absolute;
top: 0;
left: 0;
right: 0;
bottom: 0;
margin: auto;
min-width: 50%;
min-height: 50%;
}
h2
{
font-style: bold;
font-size: 40px;
color: white;
}
ul.nav
{
list-style: none; padding: 4px;
color: white;
}
ul.nav li
{
display: inline;
color: white;
}
a:link {
color: white;
}
a:visited {
color: white;
}
a:hover {
color: white;
text-decoration: underline;
}
a:active {
color: white;
}
img {
width: 42px;
height: 42px;
}