gpt4 book ai didi

html - 我如何将我的 (html) 登录页面和其他页面链接到我的索引页面

转载 作者:行者123 更新时间:2023-11-28 00:19:50 25 4
gpt4 key购买 nike

下面是我的代码。我想在我的 index.html 页面和其他页面之间创建一个链接,这样每当我点击登录或任何其他页面时,它都会将我重定向到特定页面。我怎样才能做到这一点?

我尝试使用 href 但它不起作用,因为我想我已经使用了 span 并在 CSS 中设置了 span 的样式。这是侧边栏导航响应页面。

This is how the page looks
This is how it looks underlined

index.html代码:

<!DOCTYPE html>
<html lang="en">

<head>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta charset="UTF-8">
<link rel="stylesheet" href="index.css">
<link rel="stylesheet" href="https://use.fontawesome.com/releases/v5.7.0/css/all.css">
<script src="https://use.fontawesome.com/d1341f9b7a.js"></script>

<title>MyWeb</title>

</head>

<body>

<div class="header">
<div class="searchbox">
<input class="search-txt" type="text" name="" placeholder="Type to search">
<a class="search-btn" href="#">
<i class="fas fa-search"></i>
</a>
</div>
</div>

<input type="checkbox" class="openSidebarMenu" id="openSidebarMenu">
<label for="openSidebarMenu" class="sidebarIconToggle">
<div class="spinner diagonal part-1"></div>
<div class="spinner horizontal"></div>
<div class="spinner diagonal part-2"></div>
</label>
<div id="sidebarMenu">
<ul class="siderbarMenuInner">
<li> Rahul <span>MusicLibrary</span></li>
<li> <a href="login.html"></a> <span>Login</span></li>
<li> <a href="www.instagram.com"></a> <span>Contact Us</span></li>
<li> <a href="about.html"></a> <span>About</span></li>
</ul>
</div>
</body>

</html>

login.html代码:

<!DOCTYPE html>
<html lang="en" dir="ltr">

<head>
<meta charset="utf-8">
<title>Animated Login Form</title>
<link rel="stylesheet" href="login.css">
</head>

<body>

<form class="box" action="index.html" method="post">
<h1>Login</h1>
<input type="text" name="" placeholder="Username">
<input type="password" name="" placeholder="Password">
<input type="submit" name="" value="Login">
</form>

</body>

</html>

CSS 代码:

body {
overflow-x: hidden;
height: 100%;
}

body{
font-family: tahoma;
background: linear-gradient(90deg, #3c6382, #82ccdd);
margin: 0;
padding: 0;
}

.header{
display: block;
margin: 0 auto;
width: 100%;
max-width: 100%;
box-shadow: none;
background-color: #fc466b;
position: fixed;
height: 60px !important;
overflow: hidden;
z-index: 10;
}

.searchbox{
position: absolute;
border-radius: 40px;
right: 2%;
background: #2f3640;
height: 40px;
top: 15%;
padding: 0.1%;

}

.search-txt{
border: none;
background: none;
outline:none;
float:left;
padding: 0;
color: white;
font-size: 16px;
transition: 0.4s;
line-height: 40px;
width: 0px;

}

.search-btn{
color: #fc466b;
float:right;
width: 40px;
height: 40px;
border-radius: 50%;
background: #2f3640;
display: flex;
align-items: center;
justify-content: center;
transition: 0.4s;
text-decoration: none;
}

.searchbox:hover > .search-txt{
width: 500px;
padding: 0 6px;
}

.searchbox:hover > .search-btn{
background: white;
}

.main{
margin: 0 auto;
display: block;
height: 100%;
margin-top: 60px;
}

.mainInner{
display: table;
height: 100%;
width: 100%;
text-align: center;
}

#sidebarMenu{

height: 100%;
position: fixed;
left: 0;
width: 250px;
margin-top: 60px;
transform: translateX(-250px);
transition: transform 250ms ease-in-out;
background:linear-gradient(180deg, #fc466b, #3f5efb);

}

.siderbarMenuInner{
margin: 0;
padding: 0;
border-top: 1px solid rgba(255,255,255,0.10);
}

.siderbarMenuInner li{
list-style: none;
color: white;
text-transform: uppercase;
font-weight: bold;
padding: 20px;
cursor: pointer;
border-bottom: 1px solid rgba(255,255,255,0.10);
text-decoration: none;

}
.siderbarMenuInner li span{
display: block;
font-size: 14px;
color:rgba(255,255,255,0.50);
text-decoration: none !important;
color: inherit;
}

.sidebarMenuInner li a{
color: white;
text-transform: uppercase;
font-weight: bold;
cursor: pointer;

}

input[type="checkbox"]:checked ~ #sidebarMenu{

transform: translateX(0);
}
input[type=checkbox]{
transition: all 0.3s;
box-sizing: border-box;
display: none;
}

.sidebarIconToggle{

transition: all 0.3s;
box-sizing: border-box;
cursor: pointer;
position: absolute;
z-index: 99;
height: 100%;
width:100%;
top:22px;
left: 15px;
height: 22px;
width: 22px;
}

.spinner{
transition: all 0.3s;
box-sizing: border-box;
position: absolute;
height: 3px;
width: 100%;
background-color: white;
}

.horizontal{
transition: all 0.3s;
box-sizing: border-box;
position: relative;
float: left;
margin-top: 3px;
}

.diagonal.part-1{
position: relative;
transition: all 0.3s;
box-sizing: border-box;
float:left;
}

.diagonal.part-2{
position: relative;
transition: all 0.3s;
box-sizing: border-box;
float: left;
margin-top: 3px;
}

input[type=checkbox]:checked ~ .sidebarIconToggle > .horizontal{
transition: all 0.3s;
box-sizing: border-box;
opacity: 0;
}

input[type=checkbox]:checked ~ .sidebarIconToggle > .diagonal.part-1{
transition: all 0.3s;
box-sizing: border-box;
transform: rotate(135deg);
margin-top: 8px;
}
input[type=checkbox]:checked ~ .sidebarIconToggle > .diagonal.part-2{
transition: all 0.3s;
box-sizing: border-box;
transform: rotate(-135deg);
margin-top: -9px;
}

最佳答案

每次点击“登录”时,您只点击了一个 span-tag 而不是链接。请试试这个:

<a href="login.html"><span>Login</span></a>

关于html - 我如何将我的 (html) 登录页面和其他页面链接到我的索引页面,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/54929024/

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