How can I change the default width of a Twitter Bootstrap modal box?

后端 未结 30 2748
醉酒成梦
醉酒成梦 2020-11-27 08:38

I tried the following:

   
30条回答
  •  误落风尘
    2020-11-27 09:20

    If you're using Bootstrap 3, you need to change the modal-dialog div and not the modal div like it is shown in the accepted answer. Also, to keep the responsive nature of Bootstrap 3, it's important to write the override CSS using a media query so the modal will be full width on smaller devices.

    See this JSFiddle to experiment with different widths.

    HTML

    
    

    CSS

    @media screen and (min-width: 768px) {
        .custom-class {
            width: 70%; /* either % (e.g. 60%) or px (400px) */
        }
    }
    

提交回复
热议问题