在 Bootstrap 3 中设置 Textarea 的宽度

新手上路,请多包涵

我一直在寻找一种方法让我的“textarea”在它的列中达到 100%。我已经看到了几种不同的方法(我都无法使用)在 Bootstrap 中将“textarea”扩展到 100%。我拥有从自定义内联 CSS 样式到使用 class=“form-control col-lg-12” 到覆盖 Bootstrap 的 CSS 的所有内容。

任何人都有一个可行的建议,允许流体调整大小?

这是我拥有的代码。现在宽度稍微超过占位符文本。

 <div class="row">
            <div class="col-lg-7">
                <h2>@Model.EmployeeName</h2>
                <h3>Employee #: @Model.EmployeeNumber</h3>

                <h5>(Optional): Exception Log comments related to this shift for your Supervisor/Time Keeper.</h5>
                <textarea rows="2" placeholder="Exception Log comments."></textarea>
            </div>
            <div class="col-lg-5 text-right">
                <div ng-controller='TimeCtrl'>
                    <h2>{{ clock | date:'fullDate'}}</h2>
                    <h1>{{ clock | date:'HH:mm:ss'}}</h1>
                    <input type="submit" class="btn btn-xxlarge btn-success" value="Punch In" />
                </div>
            </div>
        </div>

原文由 Caverman 发布,翻译遵循 CC BY-SA 4.0 许可协议

阅读 1.2k
1 个回答

Simply add form-control class to your textarea if you want 100% width on it, no need to add col-lg-12 because form-control class gives the父元素到元素的 100% 宽度。

 <textarea class="form-control" rows="4" placeholder="Exception Log comments."></textarea>

原文由 Bhuwan 发布,翻译遵循 CC BY-SA 4.0 许可协议

撰写回答
你尚未登录,登录后可以
  • 和开发者交流问题的细节
  • 关注并接收问题和回答的更新提醒
  • 参与内容的编辑和改进,让解决方法与时俱进
推荐问题