Warning: file_get_contents(/data/phpspider/zhask/data//catemap/7/css/35.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Css 定位图像,使左半部分可见,右半部分位于div后面_Css_Position - Fatal编程技术网

Css 定位图像,使左半部分可见,右半部分位于div后面

Css 定位图像,使左半部分可见,右半部分位于div后面,css,position,Css,Position,我有一个我想从一个div后面“偷看”的图像:图像的左半部分从一个div后面偷看,其余部分是隐藏的 div具有以下css: #div{ float: left; position: relative; margin-left: 5%; } 对于我尝试使用的偷窥者: #peeker { position: fixed; margin-left: 2.5%; } 但是,这仅在缩放为100%时有效。当我缩小时,#Peek不再显示50% 不使用javascrip

我有一个我想从一个div后面“偷看”的图像:图像的左半部分从一个div后面偷看,其余部分是隐藏的

div具有以下css:

#div{
    float: left;
    position: relative;
    margin-left: 5%; }
对于我尝试使用的偷窥者:

#peeker {
    position: fixed;
    margin-left: 2.5%;
}
但是,这仅在缩放为100%时有效。当我缩小时,#Peek不再显示50%

不使用javascript就可以做到这一点吗

#peeker {
    position: fixed;
    margin-left: 2.5%;
    width: 5%;
}