I've found an interesting post about webkit pseudo elements for inputs here, so I was going to remove the cancel button from input type="time"
. But by murthy's law exactly this pseudo element is not described anywhere.
P.S. I already tryed
::-webkit-search-cancel-button
::-webkit-input-cancel-button
::-webkit-time-cancel-button
::-webkit-time-cancel-button
Of course there is a way to do this with :after
element, but I don't believe there is no pseudo element for this
input[type="time"]::after
{
content: "";
background: #FFF;
height: 20px;
width: 10px;
position: absolute;
margin: 0 -10px;
}
The input element has no content in the CSS view, and so has no :before or :after pseudo content. This is true of many other void or replaced elements.
The ::before selector inserts something before the content of each selected element(s). Use the content property to specify the content to insert. Use the ::after selector to insert something after the content.
Because these pseudo elements are only allowed to be used on container elements. Elements like inputs, images, and any other self closing element can't use pseudo elements because they aren't “container elements”.
A CSS pseudo-element is a keyword added to a selector that lets you style a specific part of the selected element(s). For example, ::first-line can be used to change the font of the first line of a paragraph. Note: In contrast to pseudo-elements, pseudo-classes can be used to style an element based on its state.
That would be ::-webkit-clear-button
So use
input[type="time"]::-webkit-clear-button{
display:none;
}
To find such things you can enable Show Shadow DOM from the console options, under Elements.
This way when you select the input
element, you can open it and look under the hood..
I knew that Internet Explorer 10 supports such a pseudo-element with ::-ms-clear
.
So I searched in the source code of Chromium for "webkit-clear" and discovered the presence of ::-webkit-clear-button
.
This JSFiddle shows that the ::-webkit-clear-button
pseudo-element has the desired effect.
input[type="time"]::-webkit-clear-button {
display: none;
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With