当前位置: 移动技术网 > IT编程>网页制作>HTML > less中使用last-child选择器

less中使用last-child选择器

2020年07月24日  | 移动技术网IT编程  | 我要评论

css:

.search{
    .time{
      &:first-child{
        margin-left: 0px !important;
      }
      &:nth-last-child(2){
        margin-left: -12px !important;
      }
    }
  }

html:

<div class="search">

        <div class="time">

          <span>关键字:</span>

          <el-input v-model="selected.Text" prefix-icon="el-icon-search" class="search_input" />

        </div>

        <div class="time">

          <span>记录时间:</span>

          <el-date-picker v-model="selected.Time1" type="date" placeholder="选择开始日期" class="search_input" />

        </div>

        <el-button size="small">查询</el-button>

      </div>

last-child默认的最后一个元素为button,所以设置最后一个time的样式时,要使用倒数第二个才能设置到样式

本文地址:https://blog.csdn.net/qq_20497071/article/details/107512268

如对本文有疑问, 点击进行留言回复!!

相关文章:

验证码:
移动技术网