I need assistance with creating a dynamic bootstrap modal that adjusts its width based on the content and includes a vertical scrollbar when needed.
Although the vertical scrollbar is functioning correctly, the horizontal width appears to be static. Can someone provide guidance on how to fix this issue?
Modal:
<div class="modal" id="myModal" tabindex="-1" role="dialog" aria-labelledby="myModal">
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-header"><h4 class="modal-title">Dynamic Modal Title</h4></div>
<div class="modal-body">Dynamic Modal Body</div>
<div class="modal-footer">Dynamic Modal Footer</div>
</div><!-- /.modal-content -->
</div><!-- /.modal-dialog -->
</div><!-- /.modal -->
CSS:
.modal .modal-body { /* Vertical scrollbar if necessary */
max-height: 480px;
overflow-y: auto;
}
body .modal-dialog { /* Width */
max-width: 100%;
}