I am new to ionic. I am Stuck with ion-select styling, How can I change default styles of ion-select in ionic 4? I'm not able to change it by overwriting CSS.
like this
.select-placeholder {
color: black;
opacity: 1;
}
I am new to ionic. I am Stuck with ion-select styling, How can I change default styles of ion-select in ionic 4? I'm not able to change it by overwriting CSS.
like this
.select-placeholder {
color: black;
opacity: 1;
}
Specting Html and you will find the "part" of ion-select, after that just css follow that "part".
ion-select::part(placeholder) {
color: blue;
opacity: 1 !important;
}
Here is how you do it,
window.customElements.whenDefined("ion-select").then(() => {
let selectPlaceholder = document.querySelector("ion-select").shadowRoot.querySelector(".select-placeholder");
selectPlaceholder.style.setProperty("color", "black");
selectPlaceholder.style.setProperty("opacity", "1");
});
You can try this:
.select-ios .select-placeholder{
color: #000;
font-size: 15px;
}
an unorthodox method but it was useful for me to change a js file after compiling: \ node_modules \ @ionic \ core \ dist \ esm \ es5 \ build \ j241fzpw.entry.js
select-placeholder {color: currentColor; opacity: 0.33}
for
select-placeholder {color: currentColor; opacity: 1}
I'm not sure but maybe the file in question could vary