• Skip to main content
  • Skip to forum navigation

StudioPress

  • Shop for Themes
  • My StudioPress

Forum navigation

  • Home
  • General Genesis Discussions
  • StudioPress Themes
  • Genesis Blocks
    • Genesis Blocks
    • Genesis Custom Blocks
  • Retired Themes
  • FAQs
  • Forum Rules
  • Internationalization and Translations
  • Forum Bugs and Suggestions
  • Forum Log In

Are You Using The WordPress Block Editor?

Genesis now offers plugins that help you build better sites faster with the WordPress block editor (Gutenberg). Try the feature-rich free versions of each plugin for yourself!

Genesis Blocks Genesis Custom Blocks

CSS Button Code Not Working?

Welcome!

These forums are for general discussion on WordPress and Genesis. Official support for StudioPress themes is offered exclusively at My StudioPress. Responses in this forum are not guaranteed. Please note that this forum will require a new username, separate from the one used for My.StudioPress.

Log In
Register Lost Password

Community Forums › Forums › Archived Forums › Design Tips and Tricks › CSS Button Code Not Working?

This topic is: resolved

Tagged: button, buttons, css, Metro Pro

  • This topic has 5 replies, 2 voices, and was last updated 11 years, 2 months ago by Marcy.
Viewing 6 posts - 1 through 6 (of 6 total)
  • Author
    Posts
  • January 21, 2015 at 11:11 am #138194
    chrispking
    Participant

    Hi

    I've created a button that I want to use with my Metro Pro theme site http://www.thetrainhacker.com..

    Disclaimer: I'm not a coder and don't have a clue what I'm doing 🙂

    I've got two problems..

    1. When I insert the code into my style.css via Edit Themes and then try and create a button such as...

    Call to Action

    ..no button shows up all I get is text link

    2. Right Align
    ..I'd also like to ensure that it always appears right aligned as well...

    Here's the code that I created using http://css3buttongenerator.com/

    .btn {
    background: #f96e5b;
    background-image: -webkit-linear-gradient(top, #f96e5b, #f7432a);
    background-image: -moz-linear-gradient(top, #f96e5b, #f7432a);
    background-image: -ms-linear-gradient(top, #f96e5b, #f7432a);
    background-image: -o-linear-gradient(top, #f96e5b, #f7432a);
    background-image: linear-gradient(to bottom, #f96e5b, #f7432a);
    -webkit-border-radius: 12;
    -moz-border-radius: 12;
    border-radius: 12px;
    font-family: Arial;
    color: #ffffff;
    font-size: 18px;
    padding: 7px 20px 7px 20px;
    border: solid #f62d11 1.5px;
    text-decoration: none;
    }

    .btn:hover {
    background: #f62d11;
    text-decoration: none;
    }

    Thanks in advance.

    Chris

    January 21, 2015 at 1:17 pm #138205
    Marcy
    Participant

    When you add the text in your WordPress editor, you will need to change to the editor Text tab.
    Find the link that you created that you want to be a button; it will look like this:
    <a rel="nofollow" href="#">Call to Action</a>
    In place of the # though you need to make sure that you used a real URL.

    Then you tell it to use your .btn CSS by adding class="btn", like this:
    <a class="btn" rel="nofollow" href="#">Call to Action</a>

    Save, and then you should be able to go back to the Visual tab to finish editing.


    Marcy | Amethyst Website Design | Twitter

    January 21, 2015 at 1:35 pm #138207
    chrispking
    Participant

    Hi Marcy

    Thanks very much for your response.

    The code is in my stylesheet and I've inserted the button on this page http://thetrainhacker.com/blog/night-riviera-sleeper/ (at the bottom of the content area).

    I've inserted...
    <a class="btn" href="http://thetrainhacker.com/">The Train Hacker</a>

    ..however, it appears as a text link?!

    Thanks in advance.

    Chris

    January 21, 2015 at 2:19 pm #138213
    Marcy
    Participant

    First, find this selector:

    .entry-content a {
        color: #f96e5b;
    }

    Add this below it:

    .entry-content a.btn {
    background: #f96e5b;
    background-image: -webkit-linear-gradient(top, #f96e5b, #f7432a);
    background-image: -moz-linear-gradient(top, #f96e5b, #f7432a);
    background-image: -ms-linear-gradient(top, #f96e5b, #f7432a);
    background-image: -o-linear-gradient(top, #f96e5b, #f7432a);
    background-image: linear-gradient(to bottom, #f96e5b, #f7432a);
    -webkit-border-radius: 12;
    -moz-border-radius: 12;
    border-radius: 12px;
    font-family: Arial;
    color: #ffffff;
    font-size: 18px;
    padding: 7px 20px 7px 20px;
    border: solid #f62d11 1.5px;
    text-decoration: none;
    }
    
    .entry-content a.btn:hover {
    background: #f62d11;
    text-decoration: none;
    }

    Then down in the color sections find all the lines similar to :
    .metro-pro-blue .btn:hover,
    and comment them out by added /* */ around them like this:
    /*.metro-pro-blue .btn:hover,*/


    Marcy | Amethyst Website Design | Twitter

    January 21, 2015 at 5:02 pm #138225
    chrispking
    Participant

    Hi Marcy

    How can I thank you enough 🙂 but saying I'm extremely grateful for your kindness and expert knowledge.

    I've been tinkering around for a few hours now and thanks to your help I've got amazing buttons http://thetrainhacker.com/railcards/family-friends-railcard/ My goal was to create a highlighted box/button to convert higher affiliate offers. I found this Studiopress article http://www.studiopress.com/design/colored-content-boxes-buttons.htm but didn't like the buttons. The box needs some work but it's fine for now.

    At one point before I got this post I did get the buttons working but they looked like a hybrid of the one I wanted and the one above. I de-installed the W3 Total Cache plug in as that was causing havoc with both the button and the box.

    I'm very grateful for your help.

    Wish you all the happiness, health and success for 2015.

    Chris

    January 21, 2015 at 5:07 pm #138226
    Marcy
    Participant

    Your buttons are lovely, Chris! I'm glad it all worked for you.


    Marcy | Amethyst Website Design | Twitter

  • Author
    Posts
Viewing 6 posts - 1 through 6 (of 6 total)
  • The forum ‘Design Tips and Tricks’ is closed to new topics and replies.

CTA

Ready to get started? Create a site or shop for themes.

Create a site with WP EngineShop for Themes

Footer

StudioPress

© 2026 WPEngine, Inc.

Products
  • Create a Site with WP Engine
  • Shop for Themes
  • Theme Features
  • Get Started
  • Showcase
Company
  • Brand Assets
  • Terms of Service
  • Accptable Usse Policy
  • Privacy Policy
  • Refund Policy
  • Contact Us
Community
  • Find Developers
  • Forums
  • Facebook Group
  • #GenesisWP
  • Showcase
Resources
  • StudioPress Blog
  • Help & Documentation
  • FAQs
  • Code Snippets
  • Affiliates
Connect
  • StudioPress Live
  • StudioPress FM
  • Facebook
  • Twitter
  • Dribbble