With a large text input inside <p>
tags the text overflows the bounds of the modal and off the screen requiring a horizontal scrollbar to read.
I've copied the example code from the Bootstrap documentation and simply added a long text string inside the modal-body
section. The example on the Bootstrap documentation website seems to word wrap the text correctly but my code does not.
Here is my markup:
<div class="modal fade in" id="myModal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
<h4 id="myModalLabel" class="modal-title">Modal Test</h4>
</div>
<div class="modal-body">
<p>Details below:</p>
<p>TEST: aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa</p>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-primary" data-dismiss="modal">Done</button>
</div>
</div>
</div>
</div>
You can also see exactly what I mean by horizontal overflow on the jsFiddle I created here: http://jsfiddle.net/pX39W/11/
I'm sure it's something simple and I've just been staring at it too long to notice! Any help would be much appreciated.
One option would be to use the word-wrap
property (assuming the text is one long word):
.modal-body p {
word-wrap: break-word;
}
http://jsfiddle.net/pX39W/12/
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With