如何在pug中添加带有bootstrap下拉菜单的glyphicon glyphicon-calendar?

时间:2018-07-16 17:31:38

标签: javascript html css bootstrap-4 pug

我是pug的新手,并试图在“所有月份”的下拉菜单中添加glyphicon glyphicon-calendar

.pull-right
   select.form-control.btn-primary#selectMonth(style="margin-top: -15px;")
   option(selected="selected" value='') All Months
   option(value='1' ) January
   option(value='2') February
   option(value='3') March
   option(value='4') April
   option(value='5') May
   option(value='6') June
   option(value='7') July
   option(value='8') August
   option(value='9') September
   option(value='10') October
   option(value='11') November
   option(value='12') December

如何添加glyphicons

在“所有月份”选项前,我想要glyphicon日历:
image

1 个答案:

答案 0 :(得分:1)

将glyphicon放入绝对定位的跨度内。喜欢:

div.pull-right(style="position: relative;")
   span.glyphicon.glyphicon-calendar(style="position: absolute; top:50%; left: 5px; margin-top: -0.5em; font-size: 2em;")
   select.form-control.btn-primary#selectMonth(style="padding-left: 2.5em")
      option(selected="selected" value='') All Months
      option(value='1' ) January
      option(value='2') February
      option(value='3') March
      option(value='4') April
      option(value='5') May
      option(value='6') June
      option(value='7') July
      option(value='8') August
      option(value='9') September
      option(value='10') October
      option(value='11') November
      option(value='12') December

codepen example