Left align text in button

  • 6 July 2016
  • 5 replies
  • 103 views

I am looking to left-align the text in a button instead of it being in the center. I added  
text-align: left;
to my css for the button, but it still isn’t working. 

Does anyone know how to get it to work without having to use an image?


5 replies

Hi Morgan,

The custom css that you need to use will need to reference the " label" element of the button. The script below should work for you.

<br />#button-id .label {<br />&nbsp; &nbsp; text-align: left;<br />}<br />

Just replace button-id with the actual id of the button whose text you are trying to alter.

A couple of things to note,

  1. The custom css must be added within tags (or a tag if you’re referencing an external CSS document).
  2. Some custom CSS (and even Javascript) changes may not show up in the page builder itself. You’ll have to “Save Changes” and preview the page to see if it has taken effect.
    Let us know how you go with this.

Nicely explained Andre!!

Thanks for the response, Andre! Sorry, I didn’t include the entire CSS originally, since it’s actually a pretty long one. My bad…

<br />#lp-pom-button-53 {<br /> position: absolute;<br /> display: inline-block;<br /> margin: 0 0 0 0;<br /> padding: .6rem 3.2rem .4rem 1.5rem;<br /> background: #910048;<br /> border: 0;<br /> -webkit-appearance: none;<br /> -moz-appearance: none;<br /> cursor: pointer;<br /> color: black;<br /> line-height: 2.3;<br /> font-family: 'Sanchez W03', Rockwell, "Lucida Bright", slab-serif, serif;<br /> font-weight: 300;<br /> text-align: left;<br /> text-decoration: none;<br /> overflow:hidden; }

And it’s still not working even after publishing.

Hey Morgan,

The instruction should still hold true for the complete code that you’ve provided above.

In your custom CSS, you are only referencing the Button ID which is #lp-pom-button-53

To style the text on the button, you also need to include the " label" element of the button in your script, which controls the style of the text.

So all you’ll need to do is change

#lp-pom-button-53 { 

to

#lp-pom-button-53 .label {

The rest of your CSS can remain the same.

This worked! Thank you!

Reply