06-10-2022 14:14
- Mark as New
- Bookmark
- Subscribe
- Permalink
- Report this post

06-10-2022 14:14
- Mark as New
- Bookmark
- Subscribe
- Permalink
- Report this post
- Who Voted for this post?
Hi. I'm developing a watch face right know. I still don't get over the fact that it's not possible to vertically align a text, but at least it's possible to do that horizontally...or maybe not?
The white Lines are made with Photoshop and have the exact same length. As you can see, the text is not fully centered horizontally, because the line on the right is crossing the zero.
How can something so crucial like centering a text horizontally and vertically be that hard. No wonder that there are so few good watch faces.
Answered! Go to the Best Answer.
Accepted Solutions
06-11-2022 02:21
- Mark as New
- Bookmark
- Subscribe
- Permalink
- Report this post


06-11-2022 02:21
- Mark as New
- Bookmark
- Subscribe
- Permalink
- Report this post
@ata1704- see also https://dev.fitbit.com/build/guides/user-interface/css/#monospace-numbers if it is just a number field, it might help.
Author | ch, passion for improvement.

06-11-2022 00:52
- Mark as New
- Bookmark
- Subscribe
- Permalink
- Report this post


06-11-2022 01:11 - edited 06-11-2022 01:20
- Mark as New
- Bookmark
- Subscribe
- Permalink
- Report this post

SunsetRunner
06-11-2022 01:11 - edited 06-11-2022 01:20
- Mark as New
- Bookmark
- Subscribe
- Permalink
- Report this post
- Who Voted for this post?
Hi @ata1704 perhaps it is more a problem of the font, ie each characters individual left/right spacing (as @Guy_ already implemented).
So to be sure the text is visually centered, you might need to use getBBox() to evaluate its actual (visible) width and calculate the center using this value manually.
Edit: you can use getBBox() also for centering vertically evaluating .height.
06-11-2022 02:21
- Mark as New
- Bookmark
- Subscribe
- Permalink
- Report this post


06-11-2022 02:21
- Mark as New
- Bookmark
- Subscribe
- Permalink
- Report this post
@ata1704- see also https://dev.fitbit.com/build/guides/user-interface/css/#monospace-numbers if it is just a number field, it might help.
Author | ch, passion for improvement.

06-12-2022 01:02
- Mark as New
- Bookmark
- Subscribe
- Permalink
- Report this post

06-12-2022 01:02
- Mark as New
- Bookmark
- Subscribe
- Permalink
- Report this post
- Who Voted for this post?
I could fix it monospace numbers. But thank you for mentioning getBBox(). This helped a lot to fix other issues.
But I still think it's sort of strange that texts aren't just basic text boxes, where you can define a width and height and align the text in that box vertically and horizontally just by using a tag like "center".
06-12-2022 11:42
- Mark as New
- Bookmark
- Subscribe
- Permalink
- Report this post

SunsetRunner
06-12-2022 11:42
- Mark as New
- Bookmark
- Subscribe
- Permalink
- Report this post
You can define an <svg> element to wrap your text or any element and set it to 50%,50%.
I found this really handy for positioning stuff.
But I don't think it would solve the centering issue (which also might be just a rounding if center doesn't match an integer. Just a guess)

