简体   繁体   中英

Twitter Typeahead and bootstrap-tagsinput styling not correct in IE and Chrome

Summary

I have recently been working on a message system for my website which consists of Twitter Typeahead plugin and bootstrap-tagsinput plugin. But I am having styling problems with my css when I load my page in Internet Explorer and Google Chrome whereas it works fine in firefox (probably because I used it for development and initial style editing). I was wondering how to fix this as I am not very experienced in css which is why Iv'e tried to make this question as easy on the eyes as possible.

Read Below for my issues.


Working In Firefox (Developed In)

Below are images of my input box working correctly in firefox: 在此输入图像描述

在此输入图像描述


Internet Explorer Styling Problems (EDIT: FIXED!)

  1. Input box is not aligned with glyphicon until I add a tag. 在此输入图像描述
  2. Input text is not alligned with the tags to the left. 在此输入图像描述
  3. Placeholder font colour and style does not correspond with the rest of the form. 在此输入图像描述

Google Chrome Styling Problem (EDIT: FIXED)

Typeahead dropdown it not aligned properly. (only occurs on the first tag otherwise is works fine). 在此输入图像描述


Code

My HTML:

<span id="remote" class="input-group" style="padding-bottom:10px;">
  <span class="input-group-addon"><span class="glyphicon glyphicon-user" style="font-size: 15px;"></span></span>
  <input type="text" autocomplete="off" name="msgUser" id="msgUser" class="form-control tagsInput" placeholder="Users Seperated by ,"/>
</span>

Typeahead CSS:

.accordion {
    margin-bottom:-3px;
}

.accordion-group { 
    border: none;
}

.twitter-typeahead .tt-query,
.twitter-typeahead .tt-hint {
  margin-bottom: 0;
}

.twitter-typeahead .tt-hint
{
    display: none;
}

.tt-dropdown-menu {
  position: absolute;
  top: 100%;
  left: 0;
  z-index: 1000;
  display: none;
  float: left;
  min-width: 160px;
  padding: 5px 0;
  margin: 2px 0 0;
  list-style: none;
  font-size: 14px;
  background-color: #ffffff;
  border: 1px solid #cccccc;
  border: 1px solid rgba(0, 0, 0, 0.15);
  border-radius: 4px;
  -webkit-box-shadow: 0 6px 12px rgba(0, 0, 0, 0.175);
  box-shadow: 0 6px 12px rgba(0, 0, 0, 0.175);
  background-clip: padding-box;
}
.tt-suggestion > p {
  display: block;
  padding: 3px 5px;
  clear: both;
  font-weight: normal;
  line-height: 1.428571429;
  color: #333333;
  white-space: nowrap;
}
.tt-suggestion > p:hover,
.tt-suggestion > p:focus,
.tt-suggestion.tt-cursor p {
  color: #ffffff;
  text-decoration: none;
  outline: 0;
  background-color: #428bca;
}

Bootstrap Tagsinput CSS:

.bootstrap-tagsinput { width: 100%; }

.label-info {
  background-color: #ededed !important;
}
.label-info[href]:hover,
.label-info[href]:focus {
  background-color: #ededed !important;
}

.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: 0px;
  color: #555;
  vertical-align: middle;
  max-width: 100%;
  line-height: 22px;
  cursor: text;
}
.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 {
  border: 1px solid #d9d9d9;
  margin-right: 2px;
  color: #555555;
}
.bootstrap-tagsinput .tag:hover {
  border-color: #b9b9b9;
}
.bootstrap-tagsinput .tag [data-role="remove"] {
  border: none;
  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.15), 0 1px 2px rgba(0, 0, 0, 0.15);
}
.bootstrap-tagsinput .tag [data-role="remove"]:hover:active {
  box-shadow: inset 0 3px 5px rgba(0, 0, 0, 0.15);
}

My fault that no one else could resolve this question, I shouldv'e included the javascript files too, I fixed it by editing these lines in twitter typahead js file:

var css = function() {
    "use strict";
    var css = {
        wrapper: {
            // HACK: make dropdown display in chrome properly
            //position: "relative",
            //display: "inline-block"
            position: "relative",
            verticalAlign: "top"

The wrapper wasn't sitting right in the first input and this seemed to fix it.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM