我正在尝试在 bootstrap 中设置轮播的高度。如果我将高度设置为 700px,旋转木马在响应中看起来像垃圾。那么我该如何解决这个问题,使我的轮播在桌面和智能手机等设备上看起来不错?合适的高度应该是多少?
最佳答案
您可以尝试使用vh 和vw
来获取视口(viewport)的高度和宽度
.class{
width: 50vw;
height: 50vh;
}
With vw/vh, we can size elements to be relative to the size of the viewport. The vw/vh units are interesting in that 1 unit reflects 1/100th the width of the viewport. To make an element the full width of the viewport, for example, you'd set it to width:100vw.
更多信息 refer 这个链接
1vw = 视口(viewport)宽度的 1%
1vh = 视口(viewport)高度的 1%
1vmin = 1vw 或 1vh,取小者
1vmax = 1vw 或 1vh,取大者
关于html - Bootstrap Carousel,选择高度,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/32863599/