6

I'm using RoR to make a one-month rails website. This is the code from the styles.css.scss sheet. It utilizes bootstrap. I am unsure as to why but the button color does not change despite the $btnPrimaryBackground: green text. Does anyone have any ideas or thoughts on why the button color doesn't change? Thanks.

$baseFontFamily: Oxygen;
@import url(http://fonts.googleapis.com/css?family=Oxygen);


$navbarBackgroundHighlight: white;
$navbarBackground: white;
$btnPrimaryBackground: green;

@import 'bootstrap';
body{
    padding-top: 60px;
}

@import 'bootstrap-responsive';

.navbar-inner{
    @include box-shadow(none !important);
    border: 0;
}

.footer{
    margin-top: 50px;
    color: $grayLight;
    a{
        color: $gray;
    }
}

3 Answers 3

5

If you are using Bootsrap with LESS, you can simply do:

.btn-primary {
  .buttonBackground(@yourColor, @yourColorDarker); //(button, hover)
}

If not then you simply override the button class which you want to change color:

.btn-warning { background-color: Your color; } //button

.btn-warning:hover { background-color: Your color; } //hover

Furthermore, since it appears you want to change the button color to green why dont you use the .btn-success class like so:

<%= button_tag "Hello", :class => "btn btn-success" %>

Source: Styling twitter bootstrap buttons

Sign up to request clarification or add additional context in comments.

8 Comments

I apologize- how would I implement this code? I am a beginner
Sincerest apologies - I'm not sure how to implement that into the code I posted...
Well, you just have to paste the button_tag code in whatever view you want it to be.
Also what is the difference bw the button code you gave and the one I used (i.e. one is class:, while the other is :class)? Thanks again!
I don't see where you used class: but anyways it is a basically two different ways to give a symbol a value. The one is used uses the hashrocket syntax which is :symbol => value while the one you mentioned simply uses this syntax symbol: value. Anyways, if my post helped you don't forget to mark it as the answer. Good luck!
|
2

In Bootstrap 3 buttonBackground doesn't work anymore, you have to use button-variant(@color; @background; @border) like this:

.btn-custom {
    .button-variant(@custom-color, @custom-color-bg, @custom-color-border);
}

Comments

0

You can also make your own and inherit from .btn-default. In SCSS like this:

.btn-custom { @extend .btn; @extend .btn-default; color: #6EA81A; }

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.