我在学习HTML,CSS和Javascript,并试图创建一个网站。现在我想要做的就是把图像链接,它应该是这样的:如何在图像上放置链接?
现在,我做了我的链接的造型,我尝试把绝对和相对位置,但没有任何工程。一切都在图像之前放置这些链接这里是我的HTML和CSS代码。也许我做错了什么。
body {
background-image: url("img/bg.png");
margin: 0px 0px 0px 0px;
}
img {
width: 100%;
background: no-repeat;
position: relative;
}
#header #nav {
float: right;
}
a {
font-family: 'Open Sans Condensed', sans-serif;
border: none;
background-color: transparent;
font-size: 20px;
color: black;
text-decoration: none;
margin-left: 30px;
margin-right: 20px;
font-weight: 700;
text-transform: uppercase;
}
a:focus,
a:hover {
color: #bebcc1;
}
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<link type="text/css" rel="stylesheet" href="style.css">
<link href="https://fonts.googleapis.com/css?family=Open+Sans+Condensed:700" rel="stylesheet">
</head>
<body>
<div id="header">
<div id="nav">
<a href="google.lt">Meniu</a>
<a href="google.lt">Istorija</a>
<a href="google.lt">Atsiliepimai</a>
<a href="google.lt">Kontaktai</a>
</div>
<img src="img/sumustinis.jpg">
</div>
</body>
</html>
什么意思是“把链接放在图像上”? – DamiToma
我有4个链接到网站的不同部分。这就像导航栏。 –
你想通过点击图像重定向到一个页面吗? – DamiToma