Set textarea width to 100% in bootstrap modal

前端 未结 7 1100
夕颜
夕颜 2020-12-08 18:31

Was trying all possible ways, but never succeeded:

    
7条回答
  •  慢半拍i
    慢半拍i (楼主)
    2020-12-08 18:36

    The provided solutions do resolve the issue. However, they also impact all other textarea elements with the same styling. I had to solve this and just created a more specific selector. Here is what I came up with to prevent invasive changes.

    .modal-content textarea.form-control {
        max-width: 100%;
    }
    

    While this selector may seem aggressive. It helps restrain the textarea into the content area of the modal itself.

    Additionally, the min-width solution presented, above, works with basic bootstrap modals, though I had issues when using it with angular-ui-bootstrap modals.

提交回复
热议问题