【问题标题】:input box not auto-adjusting to text bootstrap 3输入框不会自动调整为文本引导程序 3
【发布时间】:2014-05-25 21:48:05
【问题描述】:

输入框宽度不适合我的占位符文本或其内容的大小:

form.form-inline(role='form')
    div.form-group
        div.dropdown
            button.btn.btn-info.dropdown-toggle(type='button', data-toggle='dropdown') {{loadButtonText}}
                span.caret
            ul.dropdown-menu(role='menu')
                li(ng-repeat='rss in RSSList')
                    a(href='#', ng-click="loadFeed(rss.url, $event);") {{rss.Title}}
        div.form-group
            input.form-control(type='text', autocomplete='off', placeholder="This is where your feed's url will appear" data-ng-model='url')

有什么建议吗?

【问题讨论】:

  • 一个笨拙的人会很好。另外据我所知,引导程序中的输入默认宽度为 100%。它们不会根据值长度自动调整。

标签: angularjs twitter-bootstrap pug inputbox


【解决方案1】:

我无法粘贴示例链接,但我为你找到了这个。

<input placeholder="Please enter your name, address and shoe size">
<input placeholder="Please enter">

var input = document.querySelectorAll('input');
for(i=0; i<input.length; i++){
    input[i].setAttribute('size',input[i].getAttribute('placeholder').length);
}

由于有填充,您可能需要增加 5-10px 的长度

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2023-03-16
    • 2017-08-06
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多