1. PROMO Subscribe our All Access Pass @ 75% OFF & access all our 16+ premium Divi extensions: Divi Block Pro, Carousel Toolkit, etc.LEARN MORE
Dismiss Notice
NEW Divi.Help Pro Carousel AI Toolkit - Magically turn your Divi design into carousel, simply by using our online toolkit. No plugins needed. Now it works with Divi 5 as well!Try our carousel AI toolkit
BEST Divi Block - A revolutionary drag & drop tool to easily mix & match 960+ premade blocks (Light & Dark) to kick start your Divi site design. Special module designs are included as well. Also newly added AI generator & color. Now it works with Divi 5 as well!
Learn More About Divi BlockFree Version ~ 340+ Free Blocks

Solved Text as cta buttons won't centre on mobile

Discussion in 'Free Divi Community Forum' started by Divi-dur, Jan 16, 2018.

  1. Divi-dur

    Divi-dur New Member

    Hi,

    I'm very new to CSS so bear with me!

    I've added some custom CSS I found to create call to action buttons from some text in my full-width header.

    They look fine and aligned on desktop:

    desktop.png

    but on mobile they're not centrally aligned as below:

    misaligned mobile.png


    I'm thinking this is a padding/margin issue, but have tried every piece of googled advice and variations with
    @media (max-width: 980px){ additions but to no avail.

    Here's the code I'm using to style the text as CTA buttons:

    }

    /* Buttons in header, very important! */
    a.blog-cta {
    font-size: 18px; font-weight: 500; -moz-border-radius: 3px; -webkit-border-radius: 3px; border-radius: 3px; color: #FFFFFF; border-color: #FFFFFF; padding: 6px 10px; line-height: 3em; background: transparent; border: 2px solid; -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale; -moz-transition: all 0.2s; -webkit-transition: all 0.2s; transition: all 0.2s; position: relative; left: -20px;}

    a.blog-cta:hover {
    background: rgba( 255, 255, 255, 0.2 ); border: 2px solid transparent; !important; }

    Any help from anyone about how to centre these buttons on top of each other in a nicely aligned column on mobile?

    Setting these particular buttons to a fixed width rather than padded around text would probably solve it, but I don;t know how!

    If you've managed to read this far, thanks in advance!


    Matt
     
    1. PRO MEMBER PERKS Divi Mini Cart Pro Plugin - Instantly add 3 different types of mini cart to your Divi site:Learn More
  2. Divi.Help

    Divi.Help Administrator
    Staff Member

    Kindly provide your URL.
     
  3. Divi-dur

    Divi-dur New Member

    1. PRO MEMBER PERKS Divi Block Pro - Premade before / after image slider for your Divi site without using any plugins:View Demo
  4. Divi.Help

    Divi.Help Administrator
    Staff Member

    First, you need to delete the space between the button.

    Next, add this custom CSS:
    Code:
    Log In or Sign Up to view this code.
    Done! Enjoy.
     
    Divi-dur likes this.
  5. Divi-dur

    Divi-dur New Member

    Amazing, thanks!

    With a little addition of min-width to size the buttons the same regardless of word length, I have the buttons looking exactly as I wanted.

    Very grateful for this fix.
     
    1. PRO MEMBER PERKS Divi Block Pro - Premade team carousel design for your Divi site without using any plugins:View Demo