Use pseudo-classes to select webkit pseudo-elements

Not sure if the title is really clear.

What I'm trying to do is select a webkit pseudo-element (inside shadow dom) with a pseudo-class :nth-of-type.

So, I want to select the second pseudo-element -webkit-datetime-edit-textin input.

enter image description here

I thought I could do it like this:

::-webkit-datetime-edit-text:nth-of-type(2){
  display: none;
}

But that will not work.

Is there any way to do this?

Help would be greatly appreciated.

ps: for those who do not know about the possibility of viewing the shade, see paragraph nr 12 here .

+4
source share
1 answer

This is a hacking time!

. , , , , , ?

, , . , , :

: . , , : .

input::-webkit-datetime-edit-fields-wrapper {
    position: relative;
}
input::-webkit-datetime-edit-text {
    position: relative;
    z-index: 0;
    padding-right: 4px;
}
input::-webkit-datetime-edit-minute-field {
    background: white;
    z-index: 4;
    display: inline-block;
    width: 10px;
    height: 12px;
    position: absolute;
    top: 0;
    margin-left: -4px;
}
<input type=time step="1" value="00:00:00">
Hide result
+2

Source: https://habr.com/ru/post/1676652/


All Articles