Css 幻灯片内容
Css Slide Content
我正在尝试通过 css 实现推送内容。我从幻灯片菜单教程中获得了基本代码,其中大部分都运行良好。
但是我的"slide menu"在触发时一直到页面顶部,但我希望它只向上滑动屏幕尺寸的80%,而我自己应该只有这么高。试了很多,就是想不通。
HTML
<body>
<div id="container">
<input id="toggle" type="checkbox"><label for="toggle">≡</label>
<div class="content"> content</div>
<div class="slide-menu"> </div>
</div>
</body>
CSS
html, body {
height: 100%;
}
body {
margin: 0;
padding: 0;
overflow-x: hidden;
}
#container {
display: flex;
min-height: 100%;
}
input[type=checkbox] {
position: absolute;
opacity: 0;
}
label {
position: absolute;
top: 10px;
left: 40px;
z-index: 1;
display: block;
font-size:3em;
color: #444;
cursor: pointer;
transform: translate3d(0, 0, 0);
transition: transform .4s;
}
input[type=checkbox]:checked ~ label {
transform: translate3d(50px, 0, 0) rotate(0deg);
}
.content {
width:100%;
padding: 40px;
background: #00FFA3;
transform: translate3d(0, 0, 0);
transition: transform .4s;
}
input[type=checkbox]:checked ~ .content {
transform: translate3d(0, -250px, 0);
}
input[type=checkbox]:checked ~ .slide-menu {
transform: translate3d(0, 0%, 0);
}
.slide-menu {
transform: translate3d(0, 120%, 0);
position: absolute;
width: 100%;
background: #4f6b81;
color: #ddd;
left: 0;
height: 80%;
transition: all .4s;
}
你的意思是这样的:
我将 top: 20%
添加到以下 css 规则
.slide-menu {
transform: translate3d(0, 120%, 0);
position: absolute;
width: 100%;
background: #4f6b81;
color: #ddd;
left: 0;
top: 20%;
height: 80%;
transition: all .4s;
}
我正在尝试通过 css 实现推送内容。我从幻灯片菜单教程中获得了基本代码,其中大部分都运行良好。
但是我的"slide menu"在触发时一直到页面顶部,但我希望它只向上滑动屏幕尺寸的80%,而我自己应该只有这么高。试了很多,就是想不通。
HTML
<body>
<div id="container">
<input id="toggle" type="checkbox"><label for="toggle">≡</label>
<div class="content"> content</div>
<div class="slide-menu"> </div>
</div>
</body>
CSS
html, body {
height: 100%;
}
body {
margin: 0;
padding: 0;
overflow-x: hidden;
}
#container {
display: flex;
min-height: 100%;
}
input[type=checkbox] {
position: absolute;
opacity: 0;
}
label {
position: absolute;
top: 10px;
left: 40px;
z-index: 1;
display: block;
font-size:3em;
color: #444;
cursor: pointer;
transform: translate3d(0, 0, 0);
transition: transform .4s;
}
input[type=checkbox]:checked ~ label {
transform: translate3d(50px, 0, 0) rotate(0deg);
}
.content {
width:100%;
padding: 40px;
background: #00FFA3;
transform: translate3d(0, 0, 0);
transition: transform .4s;
}
input[type=checkbox]:checked ~ .content {
transform: translate3d(0, -250px, 0);
}
input[type=checkbox]:checked ~ .slide-menu {
transform: translate3d(0, 0%, 0);
}
.slide-menu {
transform: translate3d(0, 120%, 0);
position: absolute;
width: 100%;
background: #4f6b81;
color: #ddd;
left: 0;
height: 80%;
transition: all .4s;
}
你的意思是这样的:
我将 top: 20%
添加到以下 css 规则
.slide-menu {
transform: translate3d(0, 120%, 0);
position: absolute;
width: 100%;
background: #4f6b81;
color: #ddd;
left: 0;
top: 20%;
height: 80%;
transition: all .4s;
}