gpt4 book ai didi

html - 整个页面上的标签切换复选标记

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

我正在尝试使用标签来切换复选标记。当您按下标签时,复选标记被选中,但当您按下页面的另一部分时,复选标记也被选中,这不是我的意图。

我真的不明白为什么会这样。您能解释一下并说明如何修复吗?

header {
height: 100vh;
background-size: cover;
background-position: center;
margin-bottom: 50px;
display: flex;
flex-direction: column;
justify-content: center;
align-items: center;
text-align: center;
text-transform: uppercase;
color: black;
}
h1 {
font-size: 50px;
letter-spacing: 8px;
}
ul {
list-style-type: none;
margin-left: 0px;
padding-left: 0px;
}
p {
width: 600px;
margin: 0 auto 20px;
}
body {
margin-top: 0px;
margin-right: 0px;
margin-bottom: 0px;
margin-left: 0px
}
.container {
margin: auto;
width: 80%;
}
.page-content {
position: relative;
z-index: 0;
transition-duration: 0.4s;
}
.sidebar {
position: fixed;
top: 0px;
left: -180px;
right: 0;
bottom: 0px;
width: 120px;
padding: 30px;
background-color: black;
z-index: 0;
width: 120px;
transition-duration: 0.4s;
}
.sidebar a {
text-decoration: none;
opacity: 0.8;
font-family: monospace;
font-size: 25px;
}
.sidebar li {
margin-bottom: 15px;
}
.sidebar a:hover {
opacity: 1;
}
.toggle {
position: fixed;
top: 20px;
right: 0;
bottom: 0;
left: 20px;
z-index: 1;
color: black;
transition-duration: 0.4s;
}
#sidebartoggler:checked + .page-wrap .sidebar {
left: 0px;
}
#sidebartoggler:checked + .page-wrap .toggle {
left: 200px;
}
#sidebartoggler:checked + .page-wrap .page-content {
padding-left: 180px;
}
<!doctype html>
<html lang="en">

<head>
<meta charset="UTF-8">
<meta name="description" content="A page about me">
<meta name="keywords" content="web developer, projects">
<meta name="viewport" content="width=device-width, initial-scale=1.0">


<title>hello</title>


<!-- own style sheet -->
<link rel="stylesheet" href="/static/css/style.css">
<!-- favicon -->
<link rel='icon' href="/static/assets/favicon.ico">
<!-- google icons -->
<link href="https://fonts.googleapis.com/icon?family=Material+Icons" rel="stylesheet">
<!-- the icon font -->
<link href="https://fonts.googleapis.com/css?family=Inconsolata" rel="stylesheet">

</head>

<body>



<input type="checkbox" id="sidebartoggler" name="" value="">

<div class="page-wrap">

<label for="sidebartoggler"><i class="material-icons md-36 toggle">menu</i>
</label>


<div class="page-content">


<header>
<h1>title</h1>

</header>

</div>

<div class="sidebar">

<ul>
<li><a href="/index">home</a>
</li>
<li><a href="/shoutbox">shoutbox</a>
</li>
<li><a href="/resume">resume</a>
</li>
<li><a href="/projects">projects</a>
</li>
</ul>

</div>
</div>



</body>

</html>

最佳答案

删除 .toggle { right: 0;底部:0; }

关于html - 整个页面上的标签切换复选标记,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/39805649/

25 4 0