简体   繁体   English

Bootstrap3背景图片不适合div

[英]Bootstrap3 background image not fit in the div

I have a small problem whit background image, I want to put it as a background for mine central div, see the picture: 我的背景图片有一个小问题,我想将其作为我的中枢div的背景,请参见图片: 在此处输入图片说明

Picture needs to fit in the div so text can display in the center of the image, its a simple stuff but for some reason mine image not fitting the div, can someone explain what is going on and tell me how can I overcome this. 图片需要适合div,以便文本可以显示在图像的中心,这很简单,但是由于某种原因我的图像不适合div,有人可以解释发生了什么并告诉我如何克服这个问题。

Code for the background image: 背景图片代码:

.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;
}

Here is an jsfiddle working example of this image. 这是此图像的jsfiddle工作示例。

I have used background:url(../img/circle/new11.png) center center no-repeat; 我使用了background:url(../img/circle/new11.png) center center no-repeat; and this will center mine image, but that only display a part of it not the whole image. 这将使矿井图像居中,但仅显示其中一部分而不是整个图像。 So I got this: 所以我得到了这个: 后台代码之后

And I want to make it like this: 我想这样: 在此处输入图片说明

See example: fiddle 查看示例: 小提琴

CSS: CSS:

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

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM