Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

Design Sketch Basics Build a Mobile Interface Layer Styling

Apologies for one more question: is there a way to vertically center some text within the confines of a shape?

The smart guides only allow me to align the top of the text area to the center of the shape below it, or the bottom of the text area to the center of the shape below it, but I would like to center the vertical center of the text area to the center of the shape below it. I can't find any custom guides to do this manually, nor do measurements relative to the entire artboard help me. Any thoughts? Would be grateful.

At the moment the best I can do is make my text area, make note of its height, subtract that from the height of the shape below it, and divide the remainder by 2. I then make a rectangle with that sum as its height, and align the top of the text to the bottom of that rectangle, and make the rectangle invisible. It's a bit tedious.

2 Answers

Christopher Downer
Christopher Downer
Treehouse Guest Teacher

Hi Faye, I'm not really sure what you mean. It seems like something that can be solved just by using the align tools on the top of the inspector. Check this out, is this what you're wanting to do? - http://cl.ly/aDGK

Ricky Catron
Ricky Catron
13,023 Points

I am unsure if you mean centering it in sketch or in a real webpage.

In Sketch: I have no idea I am terrible at design.

In CSS: Welcome to one of the most annoying problems ever, vertically centering text... , there may be an official or better way of doing this that I do not know about as I mainly focus on the backend but whenever I do I I end up relying on the css calc function to get the most accurate high for the top margin.

Goodluck! --Ricky