调整窗口大小时如何保持对象大小相同

贾格尔

我有一个圆圈,它的宽度在一个间隔内增加,一旦达到一定比例,它就会消失并重新开始。但是每次我淡出时resize,屏幕或zoom in and out圆圈都会变成一个oval或一个真正的stretched对象。当屏幕调整大小时,如何保持圆圈,圆圈。

html

<div id="container">
    <div id="name-div">
        <h1 id="name">Open Touch</h1>
    </div>
    <ul class="bubbles">
        <li id="firstCircle"></li>
        <li id="secondCircle"></li>
        <li id="thirdCircle"></li>
        <li id="fourthCircle"></li>
        <li id="fifthCircle"></li>
        <li id="sixthCircle"></li>
    </ul>
</div>

css

.bubbles {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 0;
    transform: translateZ(0);
    -webkit-transform: translateZ(0);
    -ms-transform: translateZ(0);
    -moz-transform: translateZ(0);
    -o-transform: translateZ(0);
}

.bubbles li {
    position: absolute;
    list-style: none;
    display: block;
    border-radius: 100%;
    -ms-animation: fadeAndScale 33s ease-in infinite;
    -webkit-animation: fadeAndScale 33s ease-in infinite;
    -moz-animation: fadeAndScale 33s ease-in infinite;
    -o-animation: fadeAndScale 33s ease-in infinite;
    animation: fadeAndScale 33s ease-in infinite;
    transition-timing-function: linear;
}
/* The first Circle animation------------------------------------------------------------------------------------------------ */
.bubbles li:nth-child(1) {
    width: 9%;
    height: 20%;
    top: 20%;
    left: 20%;
    background-image: linear-gradient(45deg, #93a5cf 0%, #e4efe9 100%);
    animation-name: firstCircle;
}
/* Mozilla First Circle Animation */
@-moz-keyframes firstCircle {
    0% {
        z-index: 100;
        -moz-transform: scale(0);
    }
    100% {
        z-index: 0;
        -moz-transform: scale(200);
    }
}
/* Webkit First Circle Animation */
@-webkit-keyframes firstCircle {
    0% {
        z-index: 100;
        -webkit-transform: scale(0);
    }
    100% {
        z-index: 0;
        -webkit-transform: scale(200);
    }
}
@-ms-keyframes firstCircle {
    0% {
        z-index: 100;
        -ms-transform: scale(0);
    }
    100% {
        z-index: 0;
        -ms-transform: scale(200);
    }
}
@-o-keyframes firstCircle {
    0% {
        z-index: 100;
        -ms-transform: scale(0);
    }
    100% {
        z-index: 0;
        -ms-transform: scale(200);
    }
}
/* End first circle animation -------------------------------------------------------------------------------------- */\

/* Begin Second Circle Animation ------------------------------------------------------------------------------------ */
.bubbles li:nth-child(2) {
    width: 9%;
    height: 20%;
    position: absolute;
    left: 40%;
    top: 40%;
    animation-name: secondAnimation;
}
/* Webkit Second Animation */
@-webkit-keyframes secondAnimation {
    0% {
        z-index: 100;
        -webkit-transform: scale(0);
    }
    100% {
        z-index: 0;
        -webkit-transform: scale(200);
    }
}
/* Mozilla Second Animation */
@-moz-keyframes secondAnimation {
    0% {
        z-index: 100;
        -moz-transform: scale(0);
    }
    100% {
        z-index: 0;
        -moz-transform: scale(200);
    }
}
/* Ms Second Animation */
@-ms-keyframes secondAnimation {
    0% {
        z-index: 100;
        -ms-transform: scale(0);
    }
    100% {
        z-index: 0;
        -ms-transform: scale(200);
    }
}
@-o-keyframes secondAnimation {
    0% {
        z-index: 100;
        -ms-transform: scale(0);
    }
    100% {
        z-index: 0;
        -ms-transform: scale(200);
    }
}
/* End of Second Circle ------------------------------------------------------------------------------------- */

/*Begin of Third Circle ----------------------------------------------------------------------------------- */
.bubbles li:nth-child(3) {
    width: 9%;
    height: 20%;
    position: absolute;
    left: 60%;
    top: 10%;
    animation-name: thirdAnimation;
}
/* Webkit Third Animation */
@-webkit-keyframes thirdAnimation {
    0% {
        z-index: 100;
        -webkit-transform: scale(0);
    }
    100% {
        z-index: 0;
        -webkit-transform: scale(200);
    }
}
/* Mozilla Third Animation */
@-moz-keyframes thirdAnimation {
    0% {
        z-index: 100;
        -moz-transform: scale(0);
    }
    100% {
        z-index: 0;
        -moz-transform: scale(200);
    }
}
/* MS Third Animation */
@-ms-keyframes thirdAnimation {
    0% {
        z-index: 100;
        -ms-transform: scale(0);
    }
    100% {
        z-index: 0;
        -ms-transform: scale(200);
    }
}
@-o-keyframes thirdAnimation {
    0% {
        z-index: 100;
        -ms-transform: scale(0);
    }
    100% {
        z-index: 0;
        -ms-transform: scale(200);
    }
}
/* End of the Third Circle --------------------------------------------------------------------------------------------------------- */

/* Begin of Fourth Circle Animation ----------------------------------------------------------------------------------------------- */
.bubbles li:nth-child(4) {
    width: 9%;
    height: 20%;
    position: absolute;
    left: 10%;
    top: 60%;
    animation-name: fourthAnimation;
}
/* Webkit Fourth Animation */
@-webkit-keyframes fourthAnimation {
    0% {
        z-index: 100;
        -webkit-transform: scale(0);
    }
    100% {
        z-index: 0;
        -webkit-transform: scale(200);
    }
}
/* Mozilla Fourth Animation */
@-moz-keyframes fourthAnimation {
    0% {
        z-index: 100;
        -moz-transform: scale(0);
    }
    100% {
        z-index: 0;
        -moz-transform: scale(200);
    }
}
/* MS Fourth Animation */
@-ms-keyframes fourthAnimation {
    0% {
        z-index: 100;
        -ms-transform: scale(0);
    }
    100% {
        z-index: 0;
        -ms-transform: scale(200);
    }
}
@-o-keyframes fourthAnimation {
    0% {
        z-index: 100;
        -ms-transform: scale(0);
    }
    100% {
        z-index: 0;
        -ms-transform: scale(200);
    }
}
/* END of Fourth Animation ------------------------------------------------------------------------------------------------ */

/* Start of Fifth Animation -------------------------------------------------------------------------------------------------- */
.bubbles li:nth-child(5) {
    width: 9%;
    height: 20%;
    position: absolute;
    left: 50%;
    top: 10%;
    animation-name: fifthAnimation;
}
/* Webki Fifth Animation */
@-webkit-keyframes fifthAnimation {
    0% {
        z-index: 100;
        -webkit-transform: scale(0);
    }
    100% {
        z-index: 0;
        -webkit-transform: scale(200);
    }
}
@-moz-keyframes fifthAnimation {
    0% {
        z-index: 100;
        -moz-transform: scale(0);
    }
    100% {
        z-index: 0;
        -moz-transform: scale(200);
    }
}
@-ms-keyframes fifthAnimation {
    0% {
        z-index: 100;
        -ms-transform: scale(0);
    }
    100% {
        z-index: 0;
        -ms-transform: scale(200);
    }
}
@-o-keyframes fifthAnimation {
    0% {
        z-index: 100;
        -ms-transform: scale(0);
    }
    100% {
        z-index: 0;
        -ms-transform: scale(200);
    }
}
/* End of the Fith Circle ----------------------------------------------------------------------------------------------------- */

/* Start of the Sixth Circle ------------------------------------------------------------------------------------------------- */
.bubbles li:nth-child(6) {
    width: 9%;
    height: 20%;
    position: absolute;
    left: 80%;
    top: 60%;
    animation-name: sixthAnimation;
}
/* Webkit sixth animation */
@-webkit-keyframes sixthAnimation {
    0% {
        z-index: 100;
        -webkit-transform: scale(0);
    }
    100% {
        z-index: 0;
        -webkit-transform: scale(200);
    }
}
/* Mozilla Sixth Animation */
@-moz-keyframes sixthAnimation {
    0% {
        z-index: 100;
        -moz-transform: scale(0);
    }
    100% {
        z-index: 0;
        -moz-transform: scale(200);
    }
}
/* MS Sixth Animation */
@-ms-keyframes sixthAnimation {
    0% {
        z-index: 100;
        -ms-transform: scale(0);
    }
    100% {
        z-index: 0;
        -ms-transform: scale(200);
    }
}
@-o-keyframes sixthAnimation {
    0% {
        z-index: 100;
        -ms-transform: scale(0);
    }
    100% {
        z-index: 0;
        -ms-transform: scale(200);
    }
}
马扬克·潘德兹

相反,提供widthheight%使用中px更改以下行:

width:100%;
height: 100%;

width:100px;
height: 100px;

然后再试一次。

说明:当您使用heightand widthin 时%,这些属性取决于容器,即window在您的情况下,但如果您提供这些 inpx则无论容器高度宽度如何,它都保持不变。

本文收集自互联网,转载请注明来源。

如有侵权,请联系[email protected] 删除。

编辑于
0

我来说两句

0条评论
登录后参与评论

相关文章

来自分类Dev

SDL2:调整窗口大小时如何保持宽高比

来自分类Dev

调整窗口大小时如何保持元素居中

来自分类Dev

调整窗口大小时保持圆圈的长宽比

来自分类Dev

调整窗口大小的3D对象无法保持大小时的Java OpenGL

来自分类Dev

在JavaFX中调整窗口大小时如何调整图像大小

来自分类Dev

调整窗口大小时如何调整ListView控件的大小

来自分类Dev

调整窗口大小时如何调整ListView控件的大小

来自分类Dev

调整窗口大小时如何自动调整 JFreeChart 的大小

来自分类Dev

调整窗口大小时如何使图像流畅?

来自分类Dev

图片旁边的浮动文本,在调整窗口大小时保持位置

来自分类Dev

调整窗口大小时内容保持不变

来自分类Dev

HTML / CSS:调整浏览器窗口大小时如何使网页保持原状?

来自分类Dev

调整窗口大小时如何在边框上添加元素并保持其位置?

来自分类Dev

如何在调整窗口大小时保持chartjs / ng2-charts渐变?

来自分类Dev

调整窗口大小时如何调整布局?

来自分类Dev

调整大小时如何防止图像填充整个Tkinter窗口?

来自分类Dev

如何在WPF中调整窗口大小时缩放按钮

来自分类Dev

调整窗口大小时如何实时检测元素高度?

来自分类Dev

如何检测窗口调整大小时的延伸或收缩?

来自分类Dev

如何防止导航栏在窗口调整大小时转移?

来自分类Dev

如何在窗口调整大小时覆盖我的数组?

来自分类Dev

ReactJS:调整窗口大小时如何停止屏幕刷新状态?

来自分类Dev

调整窗口大小时如何避免导航栏元素重叠?

来自分类Dev

如何防止导航栏在窗口调整大小时转移?

来自分类Dev

如何检测窗口调整大小时的延伸或收缩?

来自分类Dev

如何在窗口调整大小时重绘画布

来自分类Dev

调整窗口大小时如何防止按钮移动

来自分类Dev

调整窗口大小时如何设置 svg 以更改位置?

来自分类Dev

调整窗口大小时,如何使特定元素最后减少?

Related 相关文章

  1. 1

    SDL2:调整窗口大小时如何保持宽高比

  2. 2

    调整窗口大小时如何保持元素居中

  3. 3

    调整窗口大小时保持圆圈的长宽比

  4. 4

    调整窗口大小的3D对象无法保持大小时的Java OpenGL

  5. 5

    在JavaFX中调整窗口大小时如何调整图像大小

  6. 6

    调整窗口大小时如何调整ListView控件的大小

  7. 7

    调整窗口大小时如何调整ListView控件的大小

  8. 8

    调整窗口大小时如何自动调整 JFreeChart 的大小

  9. 9

    调整窗口大小时如何使图像流畅?

  10. 10

    图片旁边的浮动文本,在调整窗口大小时保持位置

  11. 11

    调整窗口大小时内容保持不变

  12. 12

    HTML / CSS:调整浏览器窗口大小时如何使网页保持原状?

  13. 13

    调整窗口大小时如何在边框上添加元素并保持其位置?

  14. 14

    如何在调整窗口大小时保持chartjs / ng2-charts渐变?

  15. 15

    调整窗口大小时如何调整布局?

  16. 16

    调整大小时如何防止图像填充整个Tkinter窗口?

  17. 17

    如何在WPF中调整窗口大小时缩放按钮

  18. 18

    调整窗口大小时如何实时检测元素高度?

  19. 19

    如何检测窗口调整大小时的延伸或收缩?

  20. 20

    如何防止导航栏在窗口调整大小时转移?

  21. 21

    如何在窗口调整大小时覆盖我的数组?

  22. 22

    ReactJS:调整窗口大小时如何停止屏幕刷新状态?

  23. 23

    调整窗口大小时如何避免导航栏元素重叠?

  24. 24

    如何防止导航栏在窗口调整大小时转移?

  25. 25

    如何检测窗口调整大小时的延伸或收缩?

  26. 26

    如何在窗口调整大小时重绘画布

  27. 27

    调整窗口大小时如何防止按钮移动

  28. 28

    调整窗口大小时如何设置 svg 以更改位置?

  29. 29

    调整窗口大小时,如何使特定元素最后减少?

热门标签

归档