gpt4 book ai didi

javascript - Bootstrap3 背景图片不适合 div

转载 作者:太空宇宙 更新时间:2023-11-04 11:03:29 26 4
gpt4 key购买 nike

我有一个关于背景图片的小问题,我想把它作为我的中央 div 的背景,看图片: enter image description here

图片需要适合 div 以便文本可以显示在图像的中心,这是一个简单的东西但是由于某种原因我的图像不适合 div,有人可以解释发生了什么并告诉我我该如何克服这个。

背景图片代码:

.central_text{
width:50%;
height:50%;
background: url(../img/circle/new11.png);
-webkit-background-size: cover;
-moz-background-size: cover;
-o-background-size: cover;
background-size: cover;
}

这是一个 jsfiddle此图像的工作示例。

我使用了 background:url(../img/circle/new11.png) center center no-repeat; 这将使我的图像居中,但只显示它的一部分而不是整个图像。所以我得到了这个: After background code

我想把它变成这样: enter image description here

最佳答案

参见示例:fiddle

CSS:

.central_text{
background:url(../img/circle/new11.png) center center no-repeat;
}

关于javascript - Bootstrap3 背景图片不适合 div,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/34149027/

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