Saeed Mousavi
Saeed Mousavi

Reputation: 399

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/

Upvotes: 6

Views: 21390

Answers (2)

jeffproe
jeffproe

Reputation: 165

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/

Upvotes: 12

Harutyun Abgaryan
Harutyun Abgaryan

Reputation: 2023

<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>

Upvotes: 2

Related Questions