1

ブートストラップ フォーカス グローをBootstrap タグ入力(Bootstrap 3 用) に追加するには?

ここに画像の説明を入力

bootstrap-tagsinput.cssファイル:

.bootstrap-tagsinput {
  background-color: #fff;
  border: 1px solid #ccc;
  box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.075);
  display: inline-block;
  padding: 4px 6px;
  margin-bottom: 10px;
  color: #555;
  vertical-align: middle;
  border-radius: 4px;
  max-width: 100%;
  line-height: 22px;
}
.bootstrap-tagsinput input {
  border: none;
  box-shadow: none;
  outline: none;
  background-color: transparent;
  padding: 0;
  margin: 0;
  width: auto !important;
  max-width: inherit;
}
.bootstrap-tagsinput input:focus {
  border: none;
  box-shadow: none;
}
.bootstrap-tagsinput .tag {
  margin-right: 2px;
  color: white;
}
.bootstrap-tagsinput .tag [data-role="remove"] {
  margin-left: 8px;
  cursor: pointer;
}
.bootstrap-tagsinput .tag [data-role="remove"]:after {
  content: "x";
  padding: 0px 2px;
}
.bootstrap-tagsinput .tag [data-role="remove"]:hover {
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.2), 0 1px 2px rgba(0, 0, 0, 0.05);
}
.bootstrap-tagsinput .tag [data-role="remove"]:hover:active {
  box-shadow: inset 0 3px 5px rgba(0, 0, 0, 0.125);
}

ラベルを縦に並べることはできますか?

ありがとう。

4

2 に答える 2

2

親セレクターがないため、純粋な CSS では現在不可能ですが、JavaScript では実行できます。

$('.bootstrap-tagsinput').focusin(function() {
    $(this).addClass('focus');
});
$('.bootstrap-tagsinput').focusout(function() {
    $(this).removeClass('focus');
});

およびCSS:

.focus {
    border-color: #66afe9;
    outline: 0;
    -webkit-box-shadow: inset 0 1px 1px rgba(0,0,0,.075), 0 0 4px rgba(102,175,233,.6);
    box-shadow: inset 0 1px 1px rgba(0,0,0,.075), 0 0 4px rgba(102,175,233,.6);
}
于 2014-08-14T04:53:47.670 に答える
0

Bootstrap サイトから直接。彼らのフォーカス CSS を見ると、次のようになります。

#focusedInput {
    border-color: rgba(82,168,236,.8);
    outline: 0;
    outline: thin dotted \9;
    -moz-box-shadow: 0 0 8px rgba(82,168,236,.6);
    box-shadow: 0 0 8px rgba(82,168,236,.6);
}

試してみたいことは、上記のコードからクラスに上記を追加することです。このようになります。

.bootstrap-tagsinput input:focus {
    border: none;
    box-shadow: none;
    border-color: rgba(82,168,236,.8);
    outline: 0;
    outline: thin dotted \9;
    -moz-box-shadow: 0 0 8px rgba(82,168,236,.6);
    box-shadow: 0 0 8px rgba(82,168,236,.6);
}

私はこれを何も試していません。しかし、これはあなたを助けるかもしれないと思います。

于 2013-11-13T20:58:30.170 に答える