Specify Modal Size

1

I've added a modal to my site, and I'm trying to change the size of it. But as much as I change its css, it does not apply to the site, I'm changing it inside the bootstrap.min.css file of my site, as in the image below

Canyouhelpme?

----------------------------Afterediting-----------------------------

    
asked by anonymous 12.01.2018 / 15:42

2 answers

1

You have to do an Override in the <div class="modal-dialog"> class of Bootstrap.

.modal-dialog {
    width: 400px !important; /* aqui vc coloca a largura que deseja */
    margin: 30px auto;
}

Type like this:

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="utf-8" />
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <title>Page Title</title>
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <link rel="stylesheet" type="text/css" media="screen" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css" />
    <link rel="stylesheet" type="text/css" media="screen" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap-theme.min.css" />
    <link rel="stylesheet" type="text/css" media="screen" href="https://maxcdn.bootstrapcdn.com/font-awesome/4.7.0/css/font-awesome.min.css" />
<style>
    .modal-dialog {
        width: 400px !important; /* aqui vc coloca a largura que deseja */
        margin: 30px auto;
    }
</style>
</head>
<body>
        
    <button type="button" class="btn btn-primary" data-toggle="modal" data-target="#exampleModal">
        Launch demo modal
      </button>
      
      <!-- Modal -->
      <div class="modal fade" id="exampleModal" tabindex="-1" role="dialog" aria-labelledby="exampleModalLabel" aria-hidden="true">
        <div class="modal-dialog" role="document">
          <div class="modal-content">
            <div class="modal-header">
              <h5 class="modal-title" id="exampleModalLabel">Modal title</h5>
              <button type="button" class="close" data-dismiss="modal" aria-label="Close">
                <span aria-hidden="true">&times;</span>
              </button>
            </div>
            <div class="modal-body">
              ...
            </div>
            <div class="modal-footer">
              <button type="button" class="btn btn-secondary" data-dismiss="modal">Close</button>
              <button type="button" class="btn btn-primary">Save changes</button>
            </div>
          </div>
        </div>
      </div>
    
    <script src="https://code.jquery.com/jquery-3.2.1.min.js"></script><scriptsrc="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js"></script>
</body>
</html>
    
12.01.2018 / 16:16
2

You should not change bootstrap.min.css , what you should do is set the style in your own css that should be declared after the bootstrap;

Add class:

.modal { 
    width: 700px; 
}
    
12.01.2018 / 15:59