gpt4 book ai didi

html - 为什么 href 不处理我的内容?

转载 作者:行者123 更新时间:2023-11-28 05:14:38 25 4
gpt4 key购买 nike

出于某种原因,我只能做 <a href=""> </a>在我的内容上建立链接,当我尝试将它添加到整个 div 时,它根本不起作用。有谁知道发生了什么,我正在尝试制作 <div class="content">起到链接的作用。到目前为止<div class="content" href="index.html">没用。我在这里编码有误还是我遗漏了错误?谢谢。

body {
background-color: #323232;
width: 100%;
padding: 0;
margin: 0;
font-family: Lato;
}

nav a {
color: #fff;
text-decoration: none;
padding: 20px 25px;
display: inline-block;
}

.fixed-header, .fixed-footer {
background: #333;
color: #fff;
width: 100%;
position: fixed;
text-align: center;
z-index: 10;
background-color: #202020;
}

.fixed-header {
top: 0;
}

.fixed-footer {
bottom: 0;
padding: 20px 0px;
}

.fixed-header a:hover {
color: #c1c1c1;
}

.fixed-footer a {
color: #fff;
font-weight: lighter;
text-decoration: none;
}


.group-content {
max-width: 960px;
text-align: center;
width: 75%;
margin: 100px auto;
display: flex;
flex-wrap: wrap;
justify-content: space-evenly;

}

.group-content h3 {
margin-top: 10px;
font-weight: normal;
font-size: 20px;
color: white;
}

.group-content p {
margin-top: 3px;
font-weight: lighter;
font-size: 20px;
color: white;
}

.content {
width: 30%;
background-color: #202020;
display: flex;
flex-direction: column;
padding: 20px 0 20px 0;
align-items: center;
margin-top: 20px;
}

.content >* {
max-width: 200px;
text-align: center;
margin: 0;
}

@font-face {
font-family: "Lato";
font-weight: normal;
font-style: normal;
src: url('fonts/Lato-Regular.eot'),
src: url('fonts/Lato-Regular.eot?#iefix') format('embedded-opentype'),
url('fonts/Lato-Regular.ttf') format('truetype'),
url('fonts/Lato-Regular.woff') format('woff'),
url('fonts/Lato-Regular.woff2') format('woff2');
}

@font-face {
font-family: "Lato";
font-weight: bold;
font-style: normal;
src: url('fonts/Lato-Bold.eot'),
src: url('fonts/Lato-Bold.eot?#iefix') format('embedded-opentype'),
url('fonts/Lato-Bold.ttf') format('truetype'),
url('fonts/Lato-Bold.woff') format('woff'),
url('fonts/Lato-Bold.woff2') format('woff2');
}

@font-face {
font-family: "Lato";
font-weight: lighter;
font-style: normal;
src: url('fonts/Lato-Light.eot'),
src: url('fonts/Lato-Light.eot?#iefix') format('embedded-opentype'),
url('fonts/Lato-Light.ttf') format('truetype'),
url('fonts/Lato-Light.woff') format('woff'),
url('fonts/Lato-Light.woff2') format('woff2');
}
<!DOCTYPE html>

<html lang="en">

<head>
<title>Kumo99.cf</title>
<meta charset="UTF-8">
<link rel="stylesheet" type="text/css" href="css/style.css">
<link rel="icon" href="favicon.ico">
</head>

<body>

<div class="fixed-header">
<nav>
<a href="index.html">HOME</a>
<a href="projects.html">PROJECTS</a>
<a href="about.html">ABOUT</a>
</nav>
</div>

<div class="fixed-footer">
<a href="https://steamcommunity.com/id/kumo99">Made by Kumo © 2018</a>
</div>

<div class="group-content", href="index.html">
<div class="content">
<img src="images/arma.png">
<h3>Arma 3: Exile Server</h3>
<p>A project for improving the exile mod.</p>
</div>

<div class="content">
<img src="images/soon.png">
<h3>Reserved Space</h3>
<p>Reserved space for future projects</p>
</div>

<div class="content">
<img src="images/soon.png">
<h3>Reserved Space</h3>
<p>Reserved space for future projects</p>
</div>

<div class="content">
<img src="images/soon.png">
<h3>Reserved Space</h3>
<p>Reserved space for future projects</p>
</div>

<div class="content">
<img src="images/soon.png">
<h3>Reserved Space</h3>
<p>Reserved space for future projects</p>
</div>

<div class="content">
<img src="images/soon.png">
<h3>Reserved Space</h3>
<p>Reserved space for future projects</p>
</div>
</div>

</body>
</html>

最佳答案

“href”属性不适用于“div”元素。 'href' 属性只适用于 'a' 标签。因此,将“div”元素包装在“a”元素中。

<a href = "index.html">
<div class ="group-content">
<!-- Insert your code here -->
</div>
</a>

或者你可以将 'a' 元素包裹在 'div' 元素中

    <div class ="group-content">    
<a href = "index.html">
<!-- Insert your code here -->
</a>
</div>

关于html - 为什么 href 不处理我的内容?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/48055112/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com