Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/html/81.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

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/5/fortran/2.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
Html 如果高度设置为100%,滑块将消失_Html_Css_Web_Slider - Fatal编程技术网

Html 如果高度设置为100%,滑块将消失

Html 如果高度设置为100%,滑块将消失,html,css,web,slider,Html,Css,Web,Slider,我正在使用html和css制作一个滑块。它工作正常,但如果我将高度设置为100%,它就会消失。如果我使用像素而不是百分比,效果很好,但是当我使用假设100%或任何带有百分比的东西时,它将不会显示 这一切都发生在.imgcont 正文{ 身高:100%; } .幻灯片{ 身高:100%; 宽度:100%; 填充物:5px; } .imgcont{ 宽度:50%; 身高:100%; 动画:showpromo 20s线性无限; } @关键帧showpromo{ 0%{背景图像:url(1.JPG);

我正在使用html和css制作一个滑块。它工作正常,但如果我将高度设置为100%,它就会消失。如果我使用像素而不是百分比,效果很好,但是当我使用假设100%或任何带有百分比的东西时,它将不会显示

这一切都发生在.imgcont

正文{
身高:100%;
}
.幻灯片{
身高:100%;
宽度:100%;
填充物:5px;
}
.imgcont{
宽度:50%;
身高:100%;
动画:showpromo 20s线性无限;
}
@关键帧showpromo{
0%{背景图像:url(1.JPG);背景大小:100%100%;}
15%{背景图像:url(2.JPG);背景大小:100%100%;}
20%{背景图像:url(3.JPG);背景大小:100%100%;}
35%{背景图像:url(4.JPG);背景大小:100%100%;}
40%{背景图像:url(5.JPG);背景大小:100%100%;}
55%{背景图像:url(1.JPG);背景大小:100%100%;}
60%{背景图像:url(2.JPG);背景大小:100%100%;}
75%{背景图像:url(3.JPG);背景大小:100%100%;}
80%{背景图像:url(4.JPG);背景大小:100%100%;}
100%{背景图像:url(5.JPG);背景大小:100%100%;}
}

这将对您有效。

我使用了
100vw
高度
100vw

您可以找到
vw
文档。

正文{
身高:100%;
宽度:100%;
填充:0px;
边际:0px;
}
.幻灯片{
高度:100vh;
宽度:100vw;
填充物:5px;
}
.imgcont{
宽度:100%;
身高:100%;
动画:showpromo 20s线性无限;
}
@关键帧showpromo{
0% {
背景图片:url(http://www.menucool.com/slider/prod/image-slider-2.jpg);
背景大小:100%100%;
}
15% {
背景图片:url(https://hdwallpaperz.net/wp-content/uploads/2017/01/Images-9.jpg);
背景大小:100%100%;
}
20% {
背景图片:url(https://www.w3schools.com/css/trolltunga.jpg);
背景大小:100%100%;
}
35% {
背景图片:url(https://static.pexels.com/photos/248797/pexels-photo-248797.jpeg);
背景大小:100%100%;
}
40% {
背景图片:url(http://static3.businessinsider.com/image/58dbde7c77bb7050008b4ae9-1190-625/nasas-1-billion-jupiter-probe-just-sent-back-breathtaking-new-images-of-the-gas-giant.jpg);
背景大小:100%100%;
}
55% {
背景图片:url(http://www.menucool.com/slider/prod/image-slider-2.jpg);
背景大小:100%100%;
}
60% {
背景图片:url(https://hdwallpaperz.net/wp-content/uploads/2017/01/Images-9.jpg);
背景大小:100%100%;
}
75% {
背景图片:url(https://www.w3schools.com/css/trolltunga.jpg);
背景大小:100%100%;
}
80% {
背景图片:url(https://static.pexels.com/photos/248797/pexels-photo-248797.jpeg);
背景大小:100%100%;
}
100% {
背景图片:url(http://static3.businessinsider.com/image/58dbde7c77bb7050008b4ae9-1190-625/nasas-1-billion-jupiter-probe-just-sent-back-breathtaking-new-images-of-the-gas-giant.jpg);
背景大小:100%100%;
}
}

这将对您有效。

我使用了
100vw
高度
100vw

您可以找到
vw
文档。

正文{
身高:100%;
宽度:100%;
填充:0px;
边际:0px;
}
.幻灯片{
高度:100vh;
宽度:100vw;
填充物:5px;
}
.imgcont{
宽度:100%;
身高:100%;
动画:showpromo 20s线性无限;
}
@关键帧showpromo{
0% {
背景图片:url(http://www.menucool.com/slider/prod/image-slider-2.jpg);
背景大小:100%100%;
}
15% {
背景图片:url(https://hdwallpaperz.net/wp-content/uploads/2017/01/Images-9.jpg);
背景大小:100%100%;
}
20% {
背景图片:url(https://www.w3schools.com/css/trolltunga.jpg);
背景大小:100%100%;
}
35% {
背景图片:url(https://static.pexels.com/photos/248797/pexels-photo-248797.jpeg);
背景大小:100%100%;
}
40% {
背景图片:url(http://static3.businessinsider.com/image/58dbde7c77bb7050008b4ae9-1190-625/nasas-1-billion-jupiter-probe-just-sent-back-breathtaking-new-images-of-the-gas-giant.jpg);
背景大小:100%100%;
}
55% {
背景图片:url(http://www.menucool.com/slider/prod/image-slider-2.jpg);
背景大小:100%100%;
}
60% {
背景图片:url(https://hdwallpaperz.net/wp-content/uploads/2017/01/Images-9.jpg);
背景大小:100%100%;
}
75% {
背景图片:url(https://www.w3schools.com/css/trolltunga.jpg);
背景大小:100%100%;
}
80% {
背景图片:url(https://static.pexels.com/photos/248797/pexels-photo-248797.jpeg);
背景大小:100%100%;
}
100% {
背景图片:url(http://static3.businessinsider.com/image/58dbde7c77bb7050008b4ae9-1190-625/nasas-1-billion-jupiter-probe-just-sent-back-breathtaking-new-images-of-the-gas-giant.jpg);
背景大小:100%100%;
}
}


使用vw后是否有响应?是,始终为屏幕宽度的100%
vw
=
视口宽度
使用vw后是否有响应?是,始终为屏幕宽度的100%
vw
=
视口宽度