gpt4 book ai didi

html - 在 Bootstrap col 中定位绝对项

转载 作者:太空宇宙 更新时间:2023-11-04 09:13:15 25 4
gpt4 key购买 nike

我正在尝试将绝对定位的 block 动画化到 Bootstrap 列中。

问题是 bootstrap col 没有固定宽度,所以在不同的屏幕上,我所有的绝对元素都会有不同的

What would be amazing is that if I set an element to for example: translateX(50%). It will always be in the center of my col-xs-4

enter image description here

有没有人有这方面的经验?

我试过了

使用 transform:translate 百分比或像素。

@keyframes animation {
0% {transform: translateX(-100%) }
100% {transform: translateX(0) }
}

这不起作用,因为百分比不是基于 Bootstrap 列的宽度。所以它不是响应式的,并且对于每个屏幕尺寸,最终都会出现在不同的地方。

最佳答案

左:50%; transform: translateX(-50%;) 将在 .col-xs-4

中水平居中

关于html - 在 Bootstrap col 中定位绝对项,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/41962523/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com