Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Bootstrap 3 modal shows a transparent background

I created a simple HTML with bootstrap 3.2 :

<body>
    <div>
        <a class="btn" href="#frmLogin" data-toggle="modal">login</a>
    </div>

    <div class="modal fade" id="frmLogin" role="dialog">
        <div class="modal-dialog">
            <div class="modal-content>">
                <div class="modal-header">
                    <a class="btn" data-dismiss="modal">×</a>
                    <h3 id="modalTitle">Login</h3>
                </div>

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

but the modal does not show correctly.

fiddle link : http://jsfiddle.net/jsmLxhv9/1/

like image 865
Saeed Mousavi Avatar asked Oct 04 '14 12:10

Saeed Mousavi


People also ask

How do you make a modal transparent?

The modal-header selector's border-color has an alpha channel set to 2f , which is more transparent, since 00 is a fully transparent alpha channel value. The . modal-content has its alpha channel set to 44 , which makes it more opaque.

How do I remove modal backdrop?

Add data-backdrop="false" option as attribute to the button which opens the modal. Save this answer. Show activity on this post. I was able to use the following snippet to hide the model overlay by just re-hiding the modal when the shown.

What is backdrop in bootstrap modal?

The backdrop option specifies whether the modal should have a dark overlay (the background color of the current page) or not. Modal with Overlay (backdrop:true) Modal without Overlay (backdrop:false) Modal with backdrop:"static" ×

What is modal fade in bootstrap?

The .fade class adds a transition effect which fades the modal in and out. Remove this class if you do not want this effect. The attribute role="dialog" improves accessibility for people using screen readers.


2 Answers

I'm a little late to the party here, but I had the same issue, which lead me to this post. The issue with the posted code is that

<div class="modal-content>">

needs to be

<div class="modal-content">

Other than that, it works fine. Check it out here: http://jsfiddle.net/hjqo17dq/

like image 150
jeffproe Avatar answered Oct 18 '22 09:10

jeffproe


<body>
  <!-- Button trigger modal -->
<button class="btn" data-toggle="modal" data-target="#myModal">
  Login
</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="modal-header">
        <button type="button" class="close" data-dismiss="modal"><span aria-hidden="true">&times;</span><span class="sr-only">Close</span></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>
</body>
like image 2
Harutyun Abgaryan Avatar answered Oct 18 '22 09:10

Harutyun Abgaryan