Twitter Bootstrap模态插入背景图片 [英] Twitter Bootstrap Modal Inserting a Background Image
问题描述
我有一个模式,我想添加一个背景图片。我可以改变整个模态的背景颜色和模态内的背景颜色,但是我找不到一种方法来使整个模态的背景成为图像。
换句话说,当模式弹出时,我希望它看起来像电视机在屏幕上弹出(电视显然是我的背景图像)。
我去了进入CSS并陷入混乱,但我认为我是在错误的关键词。
我试过background:url();
我尝试过将图像作为自己的类,然后尝试将类引入但不是似乎也有效。
任何想法???
是的,看到你的模式的 html
并且或者找出你正在使用的引导版本是有帮助的。
这是一个在Bootstrap 3中设置模态背景的例子。在这个例子中,背景包含了整个模态。但你也可以将它调整到只有身体的背景等。
.modal-content {
background -image:url('pathToImage');
$ / code>
示例
I have a modal and I want to add a background image. I can change the background color of the entire modal and the background color inside the modal but I can't find a way to make the background of the entire modal an image.
In other words, when the modal pops up I want it to look like a TV is popping up on the screen (TV is obviously my background image).
I went into the css and messed around but I think I am putting in the wrong key words.
I tried background: url(); I tried background-image: url()
I tried putting the image as it's own class and then trying to bring the class in but that doesn't seem to work either.
Any thoughts???
Yeah it would be helpful to see the html
of your modal and or find out which version of bootstrap you are using.
Here is an example of setting the background of an modal in Bootstrap 3. In this example the background encompasses the whole modal. But you could also adjust it to only the background of the body etc..
.modal-content{
background-image: url('pathToImage');
}
Example
这篇关于Twitter Bootstrap模态插入背景图片的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!