CSS or SASS How to change style of ::after, ::before effects of parent element when child element is active

Abbos Tajimov

html

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

css, I should change the style of .styled-select-box::after when .styled-select is :active or :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

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

bronlund

As far as I know, this is not possible with CSS alone.

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related

How can to change same css style after hover parent to child tag element?

How to style the parent element when hovering a child element?

Change CSS of parent element when child element is clicked using JQuery

How to ignore child element active region when parent:active is enable?

Change first child ::before style when .active

CSS focus on child element change a parent element

How to change background of child element when parent element is hovered?

How to apply CSS on child element when hover parent element?

Apply css style to child element of parent class

CSS - Styling child element if parent has ::before

Style child element when hover on parent

How to apply style to child of element with active state

How to change the CSS style of first-letter when hover over a parent element?

CSS: Prevent parent element getting :active pseudoclass when child element is clicked

How to style parent element based on his child

How to change ::after of child element

How to change opacity of child-element when hovering his parent

How to change the opacity of an child element when parent is hovered

Hover on a child element, change CSS on parent?

Change background of the parent when hovering a child element

How to style the background of the parent element when hovering more then one child element?

How to change the style of the outer element when input focus through CSS?

How to change CSS of child element <span> inside parent <div> element Using jQuery onclick event?

WordPress display parent element as active when current page is the child

How to capture text of parent element after checking text of child element

Sass ampersand when base uses pseudo-element (before / after)

Change Style of a child element in a CustomControl

Change parent element style with jQuery

How to Change CSS style of the same element that is NOT Hovered