【问题标题】:How to display "tagsinput" vertical?如何垂直显示“tagsinput”?
【发布时间】:2017-01-19 21:41:13
【问题描述】:

我正在使用 Jquery "tagsinput" 让用户在输入字段中创建标签。

我想垂直显示标签而不是内联。
此外,当您输入诸如“1300x1300”之类的内容时,输入似乎没有覆盖 100% 的宽度。

我该如何解决这个问题?

HTML

<table>
  <tr>
    <td class="oppningarTd">
      <input type="text" class="oppningar" data-role="tagsinput" multiple="true" />
    </td>
  </tr>
</table>

CSS

.bootstrap-tagsinput {
  background-color: #fff;
  border: 1px;
  box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.075);
  color: #555;
  vertical-align: middle;
  width: 100%;
  cursor: text;
  white-space: pre; //Just trying something
}

td.oppningarTd {
  border: 1px solid black;
  background: white;
  text-align: center;
  width: 200px !important;
}

input.oppningar {
  width: 100% !important;
  text-align: center;
}

FIDDLE
https://jsfiddle.net/Lh4jy9d4/151/

【问题讨论】:

  • 将 span 元素设为display:block,或者浮动并清除它们。 (之后,您可能想再次删除空白,并使用边距/填充。)
  • @CBroe 什么 span 元素?
  • 这个脚本用来显示实际标签的那些。使用浏览器的 DOM 检查器,查看使用的元素。

标签: html css twitter-bootstrap bootstrap-tags-input


【解决方案1】:

感谢@CBroe 的评论,我成功更改了插件的CSS。

.bootstrap-tagsinput {
    background-color: white;
    border: 0px;
    width: 100%;
    cursor: text;
}
.bootstrap-tagsinput input {
  border: none;
  box-shadow: none;
  outline: none;
  background-color: transparent;
  padding: 0;
  margin: 0;
}
.bootstrap-tagsinput.form-control input::-moz-placeholder {
  color: #777;
  opacity: 1;
}
.bootstrap-tagsinput.form-control input:-ms-input-placeholder {
  color: #777;
}
.bootstrap-tagsinput.form-control input::-webkit-input-placeholder {
  color: #777;
}
.bootstrap-tagsinput input:focus {
  border: none;
  box-shadow: none;
}
.bootstrap-tagsinput .tag {
  margin: 4px;
  color: white;
  display: block;
}
.bootstrap-tagsinput .tag [data-role="remove"] {
  float: right;
  cursor: pointer;
  color: red;
}
.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);
}

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2012-02-25
    • 1970-01-01
    • 1970-01-01
    • 2021-08-12
    相关资源
    最近更新 更多