css - 在选择中的箭头图标和文本之间添加分隔符

标签 css twitter-bootstrap bootstrap-4

我正在尝试构建一个选择菜单,我正在使用 Bootstrap 4。我替换了背景以替换选择元素中的箭头图标,但现在我需要为该图像添加左边框,但我还是找不到。

作为引用,我附上了所需内容的图片 enter image description here

这就是我到目前为止所取得的成就

enter image description here

和我到目前为止所做的代码 HTML

<select class="custom-select">
  <option disabled>Choose 1</option>
  <option>another</option>
  <option>2</option>
</select>

这是我的 CSS

.custom-select {
  background: #fff url("/assets/images/down-arrow.png") no-repeat right 0.75rem center;
  background-size: 12px 12px;
}

最佳答案

您也可以在背景中为 line 使用另一个图像,或者制作 arrowline 的组合图像

堆栈片段

.custom-select {
  background: url("https://image.flaticon.com/icons/png/128/118/118738.png") no-repeat right 0.75rem center, url("http://www.i2symbol.com/images/symbols/brackets/presentation_form_for_vertical_low_line_uFE33_icon_128x128.png") no-repeat right 2rem center;
  background-size: 12px 12px;
  width: 300px;
  height: 40px;
  -webkit-appearance: none;
  position: relative;
  padding: 0 10px;
}
<select class="custom-select">
  <option>1</option>
  <option>1</option>
  <option>1</option>
  <option>1</option>
  <option>1</option>
</select>

关于css - 在选择中的箭头图标和文本之间添加分隔符,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/48542604/

相关文章:

javascript - Bootstrap 标签输入不显示标签

javascript - 在 Angular2 应用程序中使用 bootstrap 时出现问题

css - 如何使用 Bootstrap 在小屏幕上对齐文本中心?

html - 文字背景样式

html - 如何防止表格单元格在 CSS 中换行?

html - 获取多个元素以在CSS中与文本内联显示

javascript - 使用 jquery 在表的单元格列内创建引导按钮

javascript - 自定义 html 数据列表下拉列表

html - 绝对位置扰乱了 Internet Explorer 8 中 Bootstrap 的面包屑导航

javascript - Angular 4 Bootstrap 下拉菜单需要 Popper.js