当我单击此div时,我想从屏幕的底部向下滑动图像,以覆盖其余部分:
<div class="brick" title="Brick Squad" alt="Brick Squad" onclick="location.href='#';" style="cursor: pointer;" action="wall-in">
</div>
我只想使用HTML和CSS!
答案 0 :(得分:1)
* {
box-sizing: border-box;
font-family: inherit;
margin: 0;
padding: 0;
}
html {
font-size: 62.25%;
}
body {
font-family: sans-serif;
font-size: 1.6rem;
}
.opener > span {
display: inline-block;
background-color: dodgerblue;
padding: 1rem;
margin: 1rem;
color: #fff;
border-radius: .3rem;
}
.opener > input {
display: none;
}
.opener > input:checked ~ .img {
top: 6rem !important;
}
.img {
position: fixed;
width: 100%;
height: 100%;
left: 0;
max-height: 100vh;
top: 100%;
transition: .6s;
}
<label for="ooop" class="opener">
<span>Toogle Me</span>
<input type="checkbox" name="" id="ooop">
<img class="img" src="https://images.pexels.com/photos/849835/pexels-photo-849835.jpeg?auto=compress&cs=tinysrgb&dpr=2&h=650&w=940" alt="">
</label>