Home > Web Front-end > CSS Tutorial > Why Doesn\'t My CSS `::after` Pseudo-element Render on a WebKit Select Box?

Why Doesn\'t My CSS `::after` Pseudo-element Render on a WebKit Select Box?

Mary-Kate Olsen
Release: 2024-11-23 17:18:15
Original
1065 people have browsed it

Why Doesn't My CSS `::after` Pseudo-element Render on a WebKit Select Box?

CSS :after Not Rendering with WebKit Select Box

Problem:

Manipulating select box appearances with the CSS ::after pseudo-element to create a customized dropdown without images is proving unsuccessful. Despite applying appropriate CSS rules, the :after element remains invisible.

HTML:

<select name="">
  <option value="">Test</option>
</select>
Copy after login

CSS:

select {
  -webkit-appearance: none;
  background: black;
  border: none;
  border-radius: 0;
  color: white;
}

select::after {
  content: " ";
  display: inline-block;
  width: 24px;
  height: 24px;
  background: blue;
}
Copy after login

Observation:

The :after element fails to appear despite the applied styling.

Solution:

Unfortunately, it appears that this customization is not currently feasible due to certain technical limitations in WebKit browsers. Select box rendering is often handled by the operating system rather than the browser itself, restricting the ability to fully control their appearance through CSS.

The above is the detailed content of Why Doesn't My CSS `::after` Pseudo-element Render on a WebKit Select Box?. For more information, please follow other related articles on the PHP Chinese website!

source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Latest Articles by Author
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template