gpt4 book ai didi

android - 背景图像并不总是居中

转载 作者:行者123 更新时间:2023-11-28 03:32:55 25 4
gpt4 key购买 nike

我正在为我的期末元素制作一个网站,现在正在进行最后的润色。我使用 bootstrap 编写它并使用了网格:.col-sm现在我要确保它在所有屏幕分辨率下看起来都一样。

我通过我的 LG4 进入该网站,这是 View : enter image description here

但是当在我的电脑上使用 chrome 移动分辨率查看网站时,它看起来更像我想要的方式: enter image description here

这是CSS:

#index-wrap{
background: url('pic/start.jpg') ;

margin-bottom: 0;
min-height: 50%;
background-repeat: no-repeat;
background-position: center center;
-webkit-background-size: cover;
background-size: cover;

/*now:*/
background-attachment: fixed;
}

.jumbotron {
background-color: transparent;
color: #0E76BD;
text-align: center;
height: 100vh;

}

这些是潜水层次结构:

<div id="index-wrap">
<div class="jumbotron">

-----Site Content ------

</div>
</div>

我该如何解决这个问题?

最佳答案

使用 background-size:cover 作为后备

background-size: 100vw auto;

它将背景宽度缩放到视口(viewport)的宽度,因此图像不会在任何支持视口(viewport)单位的设备(93% 的设备)上水平裁剪。

关于android - 背景图像并不总是居中,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/44636638/

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