Changing Button Colour

Open to all! Ask other shopowners for help.
Post Reply
LeeFoster
Contributor
Posts: 263
Joined: Sun Feb 28, 2021 9:41 pm
Phoenix Version: v1.0.8.20
Has thanked: 1 time
Been thanked: 5 times

Changing Button Colour

Post by LeeFoster »

I am working on a template and need to change the colour of buttons. I've added the below to my user.css file but when clicked the buttons still go green.

Code: Select all

.btn-success {
    color: #fff;
    background-color: #ff8b00;
    border-color: #ff8b00;
}


Join The Code Co-op to get access to your library in the Code Co-op Forum
ecartz
Core Team
Posts: 3084
Joined: Tue Nov 05, 2019 6:02 pm
Phoenix Version:
Has thanked: 4 times
Been thanked: 208 times

Re: Changing Button Colour

Post by ecartz »

Try changing the :focus or :visited pseudo-class versions. E.g. .btn-success:focus

More discussion: https://stackoverflow.com/a/42135352/6660678
LeeFoster
Contributor
Posts: 263
Joined: Sun Feb 28, 2021 9:41 pm
Phoenix Version: v1.0.8.20
Has thanked: 1 time
Been thanked: 5 times

Re: Changing Button Colour

Post by LeeFoster »

ecartz wrote: Sun Jun 12, 2022 9:55 pm Try changing the :focus or :visited pseudo-class versions. E.g. .btn-success:focus

More discussion: https://stackoverflow.com/a/42135352/6660678
That article really helped, thanks
14Steve14
Senior Contributor
Posts: 923
Joined: Fri Oct 25, 2019 7:01 pm
Phoenix Version: v1.0.9.1
Has thanked: 17 times
Been thanked: 103 times

Re: Changing Button Colour

Post by 14Steve14 »

LeeFoster wrote: Sun Jun 12, 2022 7:31 pm I am working on a template and need to change the colour of buttons. I've added the below to my user.css file but when clicked the buttons still go green.

Code: Select all

.btn-success {
    color: #fff;
    background-color: #ff8b00;
    border-color: #ff8b00;
}
I had a similar problem when trying to round the corners of all buttons. Some times the class is not what you think it is, and specific css needs to be added to a particular button. Most changed just using the .btn class but some did not.
LeeFoster
Contributor
Posts: 263
Joined: Sun Feb 28, 2021 9:41 pm
Phoenix Version: v1.0.8.20
Has thanked: 1 time
Been thanked: 5 times

Re: Changing Button Colour

Post by LeeFoster »

14Steve14 wrote: Mon Jun 13, 2022 8:01 am I had a similar problem when trying to round the corners of all buttons. Some times the class is not what you think it is, and specific css needs to be added to a particular button. Most changed just using the .btn class but some did not.
Had to add the below code, not as simple as I thought it would be.

Code: Select all

.btn-success:not(:disabled):not(.disabled):active {
    color: #fff;
    background-color: #ff8b00;
    border-color: #ff8b00;
}

.btn-success.focus, .btn-success:focus {
    color: #fff;
    background-color: #ff8b00;
    border-color: #ff8b00;
    box-shadow: 0 0 0 0.2rem #ff8b00;
}

.btn-success:not(:disabled):not(.disabled):active:focus, .show>.btn-success.dropdown-toggle:focus {
    box-shadow: 0 0 0 0.2rem #ff8b00;
}

.btn-success:hover {
    color: #fff;
    background-color: #ff8b00;
    border-color: #ff8b00;
}


Join The Code Co-op to get access to your library in the Code Co-op Forum
Post Reply