kros
kros

Reputation: 1257

Bootstrap Tags Input glow

How to add bootstrap focus glow to Bootstrap Tags Input (for Bootstrap 3)?

enter image description here

bootstrap-tagsinput.css file:

.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);
}

Is it possible to vertically align labels?

Thanks.

Upvotes: 1

Views: 3008

Answers (2)

Simon
Simon

Reputation: 32873

It is currently impossible in pure CSS as there is no parent selector but you can do it in JavaScript:

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

and 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);
}

Upvotes: 2

j0hnstew
j0hnstew

Reputation: 709

Straight from Bootstrap site. If you look at their focus CSS it looks like this.

#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);
}

What you might want to try is add the above onto your class from your code above. It would look like this.

.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);
}

I have not tried this on anything. But I think this might help you.

Upvotes: 0

Related Questions