简体   繁体   English

在Bootstrap模式中使特定的div背景透明

[英]Make a particular div background transparent in Bootstrap modal

This is my HTML (Bootstrap) document: 这是我的HTML(引导程序)文档:

<div modal="showModal" close="cancel()">
    <div class="modal-header text-center">
        <h2>Members who shortlisted you </h2>
    </div>
    <div class="modal-body">
        <img src="kitty.jpg"/>
    </div>
    <div class="modal-footer">
      <button class="btn btn-success" ng-click="ok()">Okay</button>
      <button class="btn" ng-click="cancel()">Cancel</button>
    </div>
</div>

I want to make the background of the modal-header part transparent so that I can see the text and images behind the popup. 我想使模式标题部分的背景透明,以便可以看到弹出窗口后面的文本和图像。 I already tried the following CSS: 我已经尝试了以下CSS:

.modal-header {
    background-color: #000000;
}

but its not working, if someone would help me then it great 但它不起作用,如果有人能帮助我,那太好了

background-color: #000000; is not transparent. 不透明。

Try either background-color:transparent (which would be the default). 尝试使用background-color:transparent (这是默认设置)。

Alternatively :background-color:rgba(0,0,0,0) . 或者:background-color:rgba(0,0,0,0)

You should note however that this will only show the background of the parent div....whatever that is. 但是,您应该注意,这只会显示父div的背景。

background-color: #000000 does not make the background transparent, it only sets the background-color to black . background-color: #000000不会使背景透明,它只会将background-colorblack

You can use one of 3 things: 您可以使用以下三种方法之一:

background-color: transparent - Sets the background color to transparent background-color: transparent -将背景颜色设置为透明

background-color: rgba(0, 0, 0, 0) - The last 0 sets opacity to 0 background-color: rgba(0, 0, 0, 0) -最后0opacity设置为0

opacity: 0 - This sets the opacity of the whole div to 0 opacity: 0将整个div的opacity设置为0

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

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