Increase modal size for Twitter Bootstrap

前端 未结 17 1594
抹茶落季
抹茶落季 2020-12-12 11:44

I am trying to change the size of the modal form or rather - have it respond to the content I render there. I am using it to render a form and would prefer to deal with scro

相关标签:
17条回答
  • 2020-12-12 12:17

    You need to make sure that it is on the #myModal .modal-body element not just #myModal (Seen a few people make this mistake) and you may also want to accomodate for the height change by changing the modals margins.

    0 讨论(0)
  • 2020-12-12 12:18

    This worked for me:

    #modal1 .modal 
    { 
         overflow-y: hidden; 
    }
    
    #modal1 .modal-dialog 
    { 
         height: 100%; 
         overflow-y: hidden; 
    }
    

    Note that in my case, I have nested modals, each having controls which require different heights when I toggle control's display inside the nested modal, so I could not apply the max-height, instead height:100% works for me well.

    0 讨论(0)
  • 2020-12-12 12:20

    Bootstrap Large model

    <div class="modal-dialog modal-lg">
    

    Bootstrap Small model

    <div class="modal-dialog modal-sm">
    
    0 讨论(0)
  • 2020-12-12 12:20

    Just set ".modal-body" height : 100% it will auto adjust the height as per your content and do put "max-height" as per your screen...

    0 讨论(0)
  • 2020-12-12 12:22

    Using the new CSS3 'vh' (or 'vw' for width) measurement (which sets the height as a fraction of the view port) use:

    .modal-body {
        max-height: 80vh; //Sets the height to 80/100ths of the viewport.
    }
    

    This way, if you're using a responsive framework, like Bootstrap, then you can keep that design in your modals too.

    0 讨论(0)
提交回复
热议问题