Minimal, Complete, and Verifiable example
This appears to be a browser bug on chrome - FF is fine and IE doesn't implement css:resize).
You can reproduce it simply with the following code by dragging the resizer right and left. It will resize out to the right with a fixed left position, but will try to center when shrinking down:
This happens for any resizable textarea
with a display:block
that is inside a center
element.
<!-- begin snippet: js hide: false -->
<!-- language: lang-html -->
<center>
<textarea style="display:block"></textarea>
</center>
<!-- end snippet -->
Solutions
Fix 1: Bootstrap sets the display
for any .form-control
to block
. You'll need to rest it to inline-block
, the text area's initial
display.
<!-- begin snippet: js hide: false -->
<!-- language: lang-css -->
textarea.form-control {
resize: both;
display: inline-block;
width: 50%;
}
<!-- language: lang-html -->
<link href="//cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/3.3.2/css/bootstrap.css" rel="stylesheet"/>
<center>
<textarea rows="4" cols="50" type="text"
class="form-control" placeholder="Description">
</textarea>
</center>
<!-- end snippet -->
Fix 2 (preferable): The <center
> element is actually deprecated, so you should use the css property text-align:center
instead. Note that now you'll need to declare the display as inline-block to properly center it within the parent div.
<!-- begin snippet: js hide: false -->
<!-- language: lang-css -->
textarea.form-control {
resize: both;
display: inline-block;
width: 50%;
}
<!-- language: lang-html -->
<link href="//cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/3.3.2/css/bootstrap.css" rel="stylesheet"/>
<div class="text-center">
<textarea rows="4" cols="50" type="text"
class="form-control" placeholder="Description">
</textarea>
</div>
<!-- end snippet -->