How to Add Color Buttons to a Genesis-Powered Website

Yesterday I published a post on How to Add Colored Content Boxes to a site powered by the Genesis Framework. Today, I’d like to do the same with adding color buttons.

There are a number of themes in the market that implement this with shortcodes. I feel that isn’t necessary and want to show you just how it easy it is to do with CSS.

We will be implementing the CSS into the Genesis parent theme when version 1.9 is released, and you can see the 6 default color buttons below:

Blue Button Link

Gray Button Link

Green Button Link

Purple Button Link

Red Button Link

Yellow Button Link

Implementing the Color Buttons

In your text editor, all you need to do is add a class to your link. Here’s how that should look:

<a class="button-blue" href="#">Blue Button Link</a>

Add Color Button CSS to Your Style Sheet

In your theme’s style.css file, place the following code and edit as necessary:

/* Color Buttons
------------------------------------------------------------ */

.button-blue,
.button-gray,
.button-green,
.button-purple,
.button-red,
.button-yellow {
    color: #fff;
    padding: 5px 10px;
}

.button-blue:hover,
.button-gray:hover,
.button-green:hover,
.button-purple:hover,
.button-red:hover,
.button-yellow:hover {
    text-decoration: none;
}

.button-blue {
    background-color: #afcde3;
    border: 1px solid #afcde3;
}

.button-blue:hover {
    background-color: #83a2be;
    border: 1px solid #83a2be;
}

.button-gray {
    background-color: #bdbdbd;
    border: 1px solid #bdbdbd;
}

.button-gray:hover {
    background-color: #919191;
    border: 1px solid #919191;
}

.button-green {
    background-color: #b2ce96;
    border: 1px solid #b2ce96;
}

.button-green:hover {
    background-color: #86a36e;
    border: 1px solid #86a36e;
}

.button-purple {
    background-color: #bebde9;
    border: 1px solid #bebde9;
}

.button-purple:hover {
    background-color: #9291c7;
    border: 1px solid #9291c7;
}

.button-red {
    background-color: #e9b3b3;
    border: 1px solid #e9b3b3;
}

.button-red:hover {
    background-color: #c78787;
    border: 1px solid #c78787;
}

.button-yellow {
    background-color: #fadf98;
    border: 1px solid #fadf98;
}

.button-yellow:hover {
    background-color: #ecb870;
    border: 1px solid #ecb870;
}

It’s THAT simple. So go on, add some color buttons to your website, and stand out!

Email Newsletter

Like what you read here in this blog post?
Get more like it delivered to your inbox daily.

Comments

  1. says

    Hey Brian, I’m learning a lot from your tutorials. But I was wondering if it would be okay if I tweaked your code for my website which uses the WordPress default theme TwentyEleven? Or is it only for users that have purchased the Genesis Framework? Thanks for sharing amazing and useful information.

  2. says

    I don’t like short codes either as they kind of lock you into a theme. Should you change themes you have bit of a mess to clean up. It’s amazing what you can do with only CSS and a bit of HTML.

    Anyway, thanks for this continuing series of how-tos.

  3. says

    Thanks Brian, this and the previos posts were something I really needed but never got the time to get into it. Now I can just copy and paste and enjoy the fruits of your labor :)

  4. says

    Thanks for whipping this up so quickly Brian.

    Personally, i’d prefer shortcodes which are flexible and don’t lock me into one particular framework like what happened with Woo.

    That’s why i’m looking for a good tutorial which i can edit to bring back to life the Woo shortcodes left over in my content!

    I think its a bit like what Matt Mullenweg stated last year. Make it easy for people to leave and they’ll stay!

    Cheers

    • says

      Using markup like divs in my tutorial don’t lock you into Genesis. It just means if you switch themes you need to make sure the CSS is in the new theme.

      Creating something like:

      [genesis_content_box_open]text goes here[genesis_content_box_close]

      would be. ;-)

      • says

        That reminds me… your last two posts both had “…… a Genesis-Powered Website” in the titles.

        Good old CSS doesn’t need any particulat platform, will work on any website.

  5. Gateway says

    Don’t know if this is unique to me alone. On google chrome, the boxes do not show on this page, it shows in safari though.

  6. Wes says

    if you think anyone would have interest, would like to see a post on adding Nav bar menu icons to each menu itemin a Genesis theme. I am using Eleven40.

    thanks

  7. says

    Hey Brian, thanks for this. Even though it’s really basic stuff, I’m sure many Genesis users will appreciate it. I have been using CSS for custom buttons, boxes, slogans, banners, and many more for quite a while. I love the control it gives me to easily create color schemes for new sites just by tweaking a few bits of code. Who needs shortcodes!

  8. says

    It may be easier to use the opacity option instead of so many colors. For example…

    .button-blue,
    .button-gray,
    .button-green,
    .button-purple,
    .button-red,
    .button-yellow {
    color: #fff;
    opacity: 0.7;
    padding: 5px 10px;
    }

    then on the hovers…

    .button-blue:hover,
    .button-gray:hover,
    .button-green:hover,
    .button-purple:hover,
    .button-red:hover,
    .button-yellow:hover {
    opacity: 1.0;
    }

    Then you can get rid of all those other :hover things.

    There is also a more logical way to do colors too. How about this….

    .button {
    color: #fff;
    opacity: 0.7;
    padding: 5px 10px;
    }
    .button:hover {
    opacity: 1.0;
    text-decoration: none;
    }
    .button.blue {
    background-color: #afcde3;
    }
    .button.gray {
    background-color: #bdbdbd;
    }
    .button.green {
    background-color: #b2ce96;
    }
    .button.purple {
    background-color: #bebde9;
    }
    .button-red {
    background-color: #e9b3b3;
    }
    .button.yellow {
    background-color: #fadf98;
    }

    /* USAGE */

    Blue Button Link

    • says

      Thanks Fred, that’s cool – I hadn’t thought of that, I really like being systematic like you have suggested.
      You can put code in to the comments- it shows you can use the “code” html tag.

  9. says

    Thanks Brian –
    Just put these in place on a new project that launched this week. Nice finishing touch! I appreciate the resources!

    Peace
    Wayne

  10. says

    Hi Brian,

    Love your site and what you’re doing here, truly an inspiration. I am curious as to how you get the newsletter signup box at the end of your posts? It seems custom, would it be as simple as copying the CSS from your site and then creating a hook for it? Where would I implement the aweber code? Thanks, and keep up the good work.

  11. says

    Hi Brain!

    Its been nice to have some color buttons and I like the simplicity of these buttons and I really appreciate you all the time provided with great simple and solid solutions. Great work Brain! :-)

  12. says

    I placed the exact code as is in my style.css (in the very bottom) and it didn’t seem to work. Is there something I need to change from the code above for it to work? Or am I placing it in the right place? (I’m using the adorable theme)

      • says

        Umm.. just checked again now and it works fine! Sorry about that, Brian. I do have a question though.. the text link inside the box comes out orange – which is my blog’s link color. Is there anyway to change the link color in the box to white? As shown above? (You can see the sample on this page: http://greeneggsandmoms.com/contact)

        • Jano says

          Yes, I have the same problem: links inside the buttons are not white as the examples. They inherit the links color of the child theme. Please, how can we solve this? Thank you!

  13. Jano says

    Hello Brian. Thanks for this great tutorial.

    It seems not to be working at enterprise child theme Ver. 1.0.1. Am I wrong?

    I just added the code provided at css style sheet and added the classes with the html editor in some of my pages.

    Am I doing something wrong?

    Thanks a lot.

  14. Vamsi says

    The tutorials are great brian, May i know how to implement the same for “[Continue Reading]” link and what font recommendation for eleven40 other than already used in the theme….

    Thanks in advance ;)

  15. Morgan says

    Hi Brian,

    I’m just getting into Genesis, and I really like it so far! I’m still a bit of a beginner, though, and when I tried to add buttons to the CSS of the Lifestyle theme, the text color and text decoration in the button code are overriden by other CSS, and so the text stays dark and underlined. How can I correct for this?

    Thanks!

    • says

      Hey Sarah, sorry for the delay in the response, I was away for a couple days.

      Are you wanting to replace all links in your site with the color buttons? I’m a little confused what you’re looking to do.

      I see on the page you linked to a color button, but shortly afterwards a normal link.

  16. Alejandro says

    But after you click the buttons the links inside the buttons become and remain orange. How can it be solved so the links remain white?

    Thanks a lot

  17. says

    Couple of questions:
    1. How can I add an image of a solid white triangle to place next to the “Red Button Link” text? I think the addition of the white triangle will help direct users to click on the button.

    2. How can I add these buttons on top of an image I have implemented within the side bar widgets?

    Any and all help on this asap would really help as I am really in the zone on finishing out this site and would love to keep the momentum going with these additions. Thanks!

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>