HubSpot / odometer

Smoothly transitions numbers with ease. #hubspot-open-source
http://github.hubspot.com/odometer/docs/welcome
MIT License
7.3k stars 712 forks source link

Text alignment #107

Open flyingtech opened 8 years ago

flyingtech commented 8 years ago

this plugin is AWESOME thank you for creating it. I cannot seam to change the text alignment to center in a jquerymobile label. everything else is working fantastic and I love it! using the default theme.

I'm still pretty new to CSS, JS and HTML so I'm stil learning. the more detailed (read: dumbed down) an answer the better.

Thank you in advanced.

adamschwartz commented 8 years ago

Hey @flyingtech thanks so much for your kind words. I’d be happy to help you with this. To make sure I understand the specific issue you’re having, would you mind sharing a code sample or link to a page exhibiting the issue? Thanks so much.

flyingtech commented 8 years ago

I'm really not sure what code would be relevant as it is part of a webapp built inside a dev environment. But here is the CSS relating to the jquerymobile label.

.Rating_OverallRating { text-decoration: none; font-weight: normal; text-align: center; font-family: Helvetica; font-size: 44px; margin: 0px 0px 0px 0px; word-wrap: break-word; white-space: normal;

but after i apply the class for the odometer the " text-align: center;" seams to be ignored and all the text aligns left. I looked for all the "text-align" in your css and changed it to "center" and added !important but no luck.

flyingtech commented 8 years ago

I'm not sure what future effect this will have on the function but i was able to get text centering working by removing the following from the .odometer.odometer-auto-theme, .odometer.odometer-theme-default on line 1 of the CSS:

display: inline-block; vertical-align: middle; vertical-align: auto; zoom: 1; *display: inline; position: relative;

raileanunalexandru commented 6 years ago

Hello, I have encountered the same inconvenient, of wanting to align the letters to the center, but just adding "text-align: center" on the odometer would not be enough, as the animation would still align the letters to the left side, creating a shifting effect.

After some investigation i found two classes that would not fill the width of their parent so they would not align the content. I'm pasting my solution here in case anyone else falls upon this.

.odometer-value { text-align: center; &.odometer-first-value, &.odometer-last-value { width: 100%; } }

huy-tran commented 6 years ago

@raileanunalexandru You are the life saver mate!

Lingonmirakel commented 6 years ago

@raileanunalexandru Thanks!

ivadimko commented 6 years ago

@raileanunalexandru thanks! You're awesome