针对具有特定ID的Bootstrap模态CSS类的问题

时间:2014-09-04 07:59:35

标签: css css3 twitter-bootstrap twitter-bootstrap-3

  

Demo

我只需要使用此CSS规则更改我在Bootstrap 3中使用的具有特定ID #firstModal的其中一个模式的背景

  #firstModal.modal-backdrop  {
     background-color: green;  
     opacity: 1 !important;
     filter: Alpha(opacity=50);
}

这是模态

<div id="firstModal" class="modal fade" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
<div class="modal-dialog">
<div class="modal-content">
    <div class="modal-header">
        <button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
            <h3 id="myModalLabel">First Modal</h3>
    </div>
    <div class="modal-body">
        <p>One fine body…</p>
    </div>
    <div class="modal-footer">
        <button class="btn" data-dismiss="modal" aria-hidden="true">Close</button>
        <button class="btn btn-primary">Save changes</button>
    </div>
</div>
</div>
</div>
你可以告诉我为什么这不起作用吗?感谢

1 个答案:

答案 0 :(得分:1)

尝试 - DEMO

<强> CSS:

/* CSS used here will be applied after bootstrap.css */

#firstModal {
  background-color: green;  
  opacity: 1 !important;
  filter: Alpha(opacity=50);
}