Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Bootstrap: how to remove the box shadow from the modal?

how can I remove the box shadow from bootstrap's modal? I tried with the css below but no luck. Any ideas?

css,

.modal-dialog {
        box-shadow: none;
        -webkit-box-shadow: none;
        -moz-box-shadow: none;
        -moz-transition: none;
        -webkit-transition: none;
    }

bootstrap,

<!-- Button trigger modal -->
<button class="btn btn-primary btn-lg" data-toggle="modal" data-target="#myModal">
  Launch demo modal
</button>

<!-- Modal -->
<div class="modal fade" id="myModal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true" data-backdrop="false">
  <div class="modal-dialog custom-class">
    <div class="modal-content">
      <div class="modal-header">
        <button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times;</button>
        <h4 class="modal-title" id="myModalLabel">Modal title</h4>
      </div>
      <div class="modal-body">
        ...
      </div>
      <div class="modal-footer">
        <button type="button" class="btn btn-default" data-dismiss="modal">Close</button>
        <button type="button" class="btn btn-primary">Save changes</button>
      </div>
    </div>
  </div>
</div>
like image 478
Run Avatar asked Feb 10 '14 08:02

Run


People also ask

How do I get rid of box shadow?

If there is something with a shadow or border on your blog that you wish to get rid of, look for the element in the CSS section of your template. Find box-shadow or border property and change it the value to 0 or none .

How do I remove a Bootstrap modal overlay?

On clicking the remove-modal button, the button which triggers the modal along with the Bootstrap modal is removed using the remove() method.

How do I remove a button shadow in Bootstrap 5?

Add shadow-none class using jquery shadow-none class is used to remove shadow in bootstrap. Also it can be simplified by adding this class using little jquery code. So you don't have to add this class to each button saperatly.


2 Answers

I did try this and seems to work

.modal-content{
    -webkit-box-shadow: 0 5px 15px rgba(0,0,0,0);
    -moz-box-shadow: 0 5px 15px rgba(0,0,0,0);
    -o-box-shadow: 0 5px 15px rgba(0,0,0,0);
    box-shadow: 0 5px 15px rgba(0,0,0,0);
}

a bootply sample

like image 150
rockStar Avatar answered Sep 22 '22 13:09

rockStar


Have no fear, there is a very simple solution to this.

You simply need to be more specific in your CSS selector and include div. The reason for this is that the style you are trying to override in the Bootstrap CSS was written div.modal-dialog {...}.

In CSS, element.class is more specific than .class, and the more specific tag will always take precedence.

So your solution is simply:

div.modal-content{
    -webkit-box-shadow: none;
    -moz-box-shadow: none;
    -o-box-shadow: none;
    box-shadow: none;
}

See the working example on bootply.

like image 45
HarleyCreative Avatar answered Sep 23 '22 13:09

HarleyCreative