Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to darken the div surrounding an alert like a modal?

I need to show alert to the user and I want it to be pretty. So I use Bootstrap's alert class, and show to user div like this:

<div class="alert alert-warning alert-dismissible" role="alert">
    Some text
</div>

This code just shows a div. What I want is to darken everything, except this div (like modals in Bootstrap do). How can I do this?

like image 792
PepeHands Avatar asked Sep 06 '25 03:09

PepeHands


1 Answers

Opens the modal, only shows the alert.

http://jsfiddle.net/phLg32eL/1

HTML:

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

<!-- Modal -->
<div class="modal fade" id="myModal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
    <div class="modal-dialog">
        <div class="modal-content">

            <div class="alert alert-warning alert-dismissible" role="alert">
                Some text
            </div>

        </div>
    </div>
</div>

CSS:

.modal-content {
    height:52px
}
like image 187
cameronjonesweb Avatar answered Sep 07 '25 20:09

cameronjonesweb