less中使用last-child选择器
程序员文章站
2022-06-15 19:39:29
css:.search{ .time{ &:first-child{ margin-left: 0px !important; } &:nth-last-child(2){ margin-left: -12px !important; } } }html:......
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