【问题标题】:StyleSheet is missing in Bootstrap3 TagsInputBootstrap3 标签输入中缺少样式表
【发布时间】:2014-07-01 10:34:26
【问题描述】:

这个bug我纠结了很久。 Bootstrap3 TagsInput 中缺少样式表(在我的网站上)

  • 这是我的网站:

我的代码是:

$('#TagForm').tagsinput('input').typeahead({ prefetch: '/api/tag/list' }).bind('typeahead:selected', $.proxy(function (obj, datum) { this.tagsinput('add', datum.value); this.tagsinput('input').typeahead('setQuery', ''); }, $('#TagForm')));

  • 这是官方网站:

而官网的代码是:

$('input').tagsinput();

// Adding custom typeahead support using http://twitter.github.io/typeahead.js
$('input').tagsinput('input').typeahead({
   prefetch: 'citynames.json'
}).bind('typeahead:selected', $.proxy(function (obj, datum) {  
  this.tagsinput('add', datum.value);
  this.tagsinput('input').typeahead('setQuery', '');
}, $('input')));

我把我的代码和官网的代码对比了一下,没有发现问题。

【问题讨论】:

    标签: twitter-bootstrap-3 bootstrap-typeahead bootstrap-tags-input


    【解决方案1】:

    看起来有一些自定义样式应用于您截取该屏幕截图的标签输入文档。如果你想完全匹配它,你可能应该复制他们的 app.css 文件,或者至少将这些样式添加到你自己的自定义 css 文件中:

    .twitter-typeahead .tt-query,
    .twitter-typeahead .tt-hint {
      margin-bottom: 0;
    }
    
    .twitter-typeahead .tt-hint
    {
        display: none;
    }
    
    .twitter-typeahead .hint-small
    {
        height: 30px;
        padding: 5px 10px;
        font-size: 12px;
        border-radius: 3px;
        line-height: 1.5;
    }
    
    .twitter-typeahead .hint-large
    {
        height: 45px;
        padding: 10px 16px;
        font-size: 18px;
        border-radius: 6px;
        line-height: 1.33;
    }
    
    .tt-dropdown-menu {
      min-width: 160px;
      margin-top: 2px;
      padding: 5px 0;
      background-color: #fff;
      border: 1px solid #ccc;
      border: 1px solid rgba(0,0,0,.2);
      *border-right-width: 2px;
      *border-bottom-width: 2px;
      -webkit-border-radius: 6px;
         -moz-border-radius: 6px;
              border-radius: 6px;
      -webkit-box-shadow: 0 5px 10px rgba(0,0,0,.2);
         -moz-box-shadow: 0 5px 10px rgba(0,0,0,.2);
              box-shadow: 0 5px 10px rgba(0,0,0,.2);
      -webkit-background-clip: padding-box;
         -moz-background-clip: padding;
              background-clip: padding-box;
    }
    
    .tt-suggestion {
      display: block;
      padding: 3px 20px;
    }
    
    .tt-suggestion.tt-is-under-cursor {
      color: #fff;
      background-color: #0081c2;
      background-image: -moz-linear-gradient(top, #0088cc, #0077b3);
      background-image: -webkit-gradient(linear, 0 0, 0 100%, from(#0088cc), to(#0077b3));
      background-image: -webkit-linear-gradient(top, #0088cc, #0077b3);
      background-image: -o-linear-gradient(top, #0088cc, #0077b3);
      background-image: linear-gradient(to bottom, #0088cc, #0077b3);
      background-repeat: repeat-x;
      filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#ff0088cc', endColorstr='#ff0077b3', GradientType=0)
    }
    
    .tt-suggestion.tt-is-under-cursor a {
      color: #fff;
    }
    
    .tt-suggestion p {
      margin: 0;
    }
    

    据我所知,这些是相关的,但您始终可以复制整个文件并删除不适用的文件。

    【讨论】:

    • 我已经用你的回答解决了这个问题。非常感谢!
    猜你喜欢
    • 2015-03-12
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2011-08-28
    • 2020-10-09
    • 1970-01-01
    • 1970-01-01
    • 2014-07-20
    相关资源
    最近更新 更多