Tuesday, 8 May 2018

015 Bootstrap Modal

Bootstrap Modal
Modal popup is like a dialog box that display over your current page.Modal popup get focus when open.Bootstrap uses attribute data-toggle="modal" and data-target to display a modal popup.

Example


<!DOCTYPE html>
<html lang="en">
<head>
<title>Bootstrap Example</title>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
           <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css">
           <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
           <script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js"></script>
</head>
<body>
<div class="container">
                  <button type="button" class="btn btn-default" data-toggle="modal" data-target="#myModal">
Display Modal</button>
</div>
             <div class="modal fade" id="myModal" role="dialog">
              <div class="modal-dialog">
                  <span>This is Modal Body</span>
              </div>
      </div>
</body>
</html>

Output

Bootstrap Example






Modal Size

You can change the size of the modal by adding the .modal-sm class for small modals or .modal-lg class for large modals.


Small Size Example

<!DOCTYPE html>
<html lang="en">
<head>
<title>Bootstrap Example</title>
<meta charset="utf-8">
       <meta name="viewport" content="width=device-width, initial-scale=1">
       <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css">
        <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
        <script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js"></script>
</head>
<body>
<div class="container">
            <button type="button" class="btn btn-default" data-toggle="modal" data-target="#myModal">
Display Modal</button>
</div>
<div class="modal fade" id="myModal" role="dialog">
<div class="modal-dialog modal-sm">
         <span>This is Modal Body</span>
</div></div>
</body>
</html>


Output:

Bootstrap Example





Small Large Example


<!DOCTYPE html>
<html lang="en">
<head>
<title>Bootstrap Example</title>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
             <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css">
             <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
              <script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js"></script>
</head>
<body>
<div class="container">
         <button type="button" class="btn btn-default" data-toggle="modal" data-target="#myModal">
Display Modal</button>
</div>
           <div class="modal fade" id="myModal" role="dialog">
          <div class="modal-dialog modal-lg">
          <span>This is Modal Body</span>
          </div></div>
</body>
</html>


Bootstrap Example

No comments:

Post a Comment

বাঙালির বেড়ানো সেরা চারটি ঠিকানা

  বাঙালি মানে ঘোড়া পাগল | দু একদিন ছুটি পেলো মানে বাঙালি চলল ঘুরতে | সে সমুদ্রই হোক , পাহাড়ি হোক বা নদী হোক। বাঙালির ...