Nested resources in css with :after and :before

萝らか妹 提交于 2019-12-11 23:08:30

问题


I need to differentiate on between finish / start date. So I would like on datepicker CSS rules applied to one text-field and others to the other.

<input id="mzti-start-date"  type="text" name="start_date" class="datepicker mzti-dp-width mzti-field-height" placeholder="Start date">
<input id="mzti-finish-date" type="text" name="finish_date" class="datepicker mzti-dp-width mzti-field-height" placeholder="End date">

And here were my CSS files:

#mzti-finish-date.datepicker:before {
content: '';
display: inline-block;
border-left: 7px solid transparent;
border-right: 7px solid transparent;
border-bottom: 7px solid #ccc;
border-bottom-color: rgba(0, 0, 0, 0.2);
position: absolute;
top: -7px;
left: 190px;  // I made a change here 
}

#mzti-finish-date .datepicker:after {
content: '';
display: inline-block;
border-left: 6px solid transparent;
border-right: 6px solid transparent;
border-bottom: 6px solid #ffffff;
position: absolute;
top: -6px;
left: 191px;  // I made a change here 
}

Unfortunately I was not able to figure out why the rules under mzti-finish-date do not apply to the finish-date box.


回答1:


There's a space in your second selector.

#mzti-finish-date .datepicker:after

Should be

#mzti-finish-date.datepicker:after

But really should be (because IDs are unique)

#mzti-finish-date:after


来源:https://stackoverflow.com/questions/18307610/nested-resources-in-css-with-after-and-before

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!