Html 在iphone容器中制作屏幕截图滚动
我正试图让一个屏幕截图在iphone中向上滚动。我有这样一个html:Html 在iphone容器中制作屏幕截图滚动,html,css,Html,Css,我正试图让一个屏幕截图在iphone中向上滚动。我有这样一个html: <div class="iphone-container"> <img src="images/partenaires.jpg" class="partner-img"alt=""> </div> 图像正在正确地向上滚动,但我希望它在到达iphone屏幕顶部时消失。因为现在当我在屏幕截图上向上滚动时看起来是这样的: 我需要在css和html中进行哪些更改才能获得正确的结果,就
<div class="iphone-container">
<img src="images/partenaires.jpg" class="partner-img"alt="">
</div>
图像正在正确地向上滚动,但我希望它在到达iphone屏幕顶部时消失。因为现在当我在屏幕截图上向上滚动时看起来是这样的:
我需要在css和html中进行哪些更改才能获得正确的结果,就像本网站第5部分中所述:
截图链接:
iphone容器的链接:
您需要做的是在iphone图像顶部放置一个与屏幕截图区域大小完全相同的div,然后将该div设置为overflow:scroll 就像这样:
<div class="iphone-container">
<div class="iphone-screenshot-area">
<img src="images/partenaires.jpg" class="partner-img"alt="">
</div>
</div>
您需要做的是在iphone图像顶部放置一个与屏幕截图区域大小完全相同的div,然后将该div设置为overflow:scroll 就像这样:
<div class="iphone-container">
<div class="iphone-screenshot-area">
<img src="images/partenaires.jpg" class="partner-img"alt="">
</div>
</div>
.iphone容器{
背景图像:url(“http://s21.postimg.org/hirg419tj/iphone.png");
背景尺寸:封面;
高度:790px;/*iphone图像的高度*/
宽度:400px;/*iphone图像的高度*/
位置:相对位置;
}
.文本持有者{
位置:绝对位置;
宽度:336px;/*iphone图像屏幕的宽度*/
高度:600px;/*iphone图像屏幕的高度*/
z指数:2;
顶部:100px;
左:38px;
溢出y:滚动;
溢出x:隐藏;
}
.iphone容器{
背景图像:url(“http://s21.postimg.org/hirg419tj/iphone.png");
背景尺寸:封面;
高度:790px;/*iphone图像的高度*/
宽度:400px;/*iphone图像的高度*/
位置:相对位置;
}
.文本持有者{
位置:绝对位置;
宽度:336px;/*iphone图像屏幕的宽度*/
高度:600px;/*iphone图像屏幕的高度*/
z指数:2;
顶部:100px;
左:38px;
溢出y:滚动;
溢出x:隐藏;
}
尝试将两个溢出替换为溢出:隐藏
@SaucedApples如果我这样做,图像将不再滚动。你可以上传图像并链接到这里,我将尝试复制。@SaucedApples只需编辑即可。谢谢,我会看看我能做什么。尝试用溢出:隐藏替换这两个溢出
@saucedappies如果我这样做,图像将不再滚动。你可以上传图像并将它们链接到这里,我将尝试复制。@saucedappies只是编辑一下,谢谢,我会看看我能做些什么。
.iphone-container {
background-image: url("../images/single-iphone.png");
background-size: cover;
height: 530px;
width: 420px;
position: absolute;
overflow-y: auto;
overflow-x: hidden;
}
.iphone-screenshot-area {
position:absolute;
top:40px; //Totally guessing here, adjust to proper value after testing
left:25px; //Also guessing here, adjust to proper value after testing
width:355px;
height:490px; //Also guessing here, adjust to proper value after testing
overflow:scroll;
}
.partner-img {
position: relative;
width: 355px;;
height: auto;
z-index: 2;
}