CSS或SASS当子元素处于活动状态时如何更改:: after,:: before父元素效果的样式

时间:2020-05-31 19:28:21

标签: html css sass

html

   <div class="styled-select-box">
     <select class="styled-select">
       <option value="20">20</option>
       <option value="30">30</option>
     </select>
    </div>

css,当 .styled-select :active 时,我应该更改 .styled-select-box :: after 的样式:focus

.styled-select-box::after {
  cursor: pointer;
  display: block;
  content: ' ';
  background-image: url(/custom-icons/arrow-down.svg);
  background-size: 12px 12px;
  height: 25px;
  width: 16px;
  opacity: 0.5;
  background-position-y: 6px;
  background-repeat: no-repeat;
}
.styled-select:active *parentElement* {
  transform: rotateX(180deg);
  transition: all 0.5s ease;
}

I tried with :has() but it not supported by browsers

我尝试了:has(),但浏览器不支持

1 个答案:

答案 0 :(得分:1)

据我所知,仅凭CSS不可能做到这一点。

相关问题