Ionic - how to change textfield background colour?

22,795

Solution 1

Are you sure your css rule matches the correct element?

Your rule:

.item .item-input {
    background-color: transparent;
}

Matches an element with class item-input, which is a descendant of an element with class item. Perhaps you meant the following?:

.item.item-input {
    background-color: transparent;
}

This rule matches an element with class item and item-input.

Solution 2

In Angular (as your question has an Angular tag), the answer is to use --background

--background: transparent !important; // example

enter image description here

see https://ionicframework.com/docs/api/input#css-custom-properties (select : Angular from the list to see Angular related docs)

Share:
22,795
Nurdin
Author by

Nurdin

My Profile - http://www.revivalx.com Data Consultant at Deepagi - https://deepagi.com KLSE & Crypto screener - https://deepagiscreener.com Github - https://github.com/datomnurdin Linkedin - http://www.linkedin.com/pub/mohammad-nurdin/57/290/692 Youtube - https://www.youtube.com/channel/UCP2lj6CO3Grss4v2ebJ1C1A #SOreadytohelp

Updated on July 05, 2022

Comments

  • Nurdin
    Nurdin almost 2 years

    I already set textfield background colour into transparent but not working in Ionic.

    .item .item-input {
        background-color: transparent;
    }
    

    I already read the Ionic documentation but it's not working. It's still white colour.

    http://ionicframework.com/docs/components/#forms-inline-labels

    enter image description here

  • Roddy of the Frozen Peas
    Roddy of the Frozen Peas about 7 years
    Do you mean rgba? Because reba is not a valid declaration for colors.