
- #Photoshop centering text vertically how to
- #Photoshop centering text vertically update
- #Photoshop centering text vertically mac
If you’ve read it well, I told that a line-box’s height is computed according to its children’s height, I didn’t say its children content-area’s height.

Until now, I introduced two notions: content-area and line-box. Even applying a background to ::first-line does not give us any visual clue on the first line-box’s height. The difficult part in the line-box creation is that we can’t really see, nor control it with CSS. We clearly see that the second line-box is taller than the others, due to the computed content-area of its children, and more specifically, the one using the Catamaran font. the second one contains two anonymous inline elements, and the 3 Ī (black border) is made of line-boxes (white borders) that contain inline elements (solid borders) and anonymous inline elements (dashed borders).the first and last one each contain a single anonymous inline element (text content).
#Photoshop centering text vertically update
If we update the previous HTML code like this: If you know the height of each line-box, you know the height of an element. As a result, a line-box is always tall enough to contain all its children (by default).Įach HTML element is actually a stack of line-boxes. The browser therefore computes the height for each inline elements, and thus the height of the line-box (from its child’s highest point to its child’s lowest point). The height of a line-box is based on its children’s height. Each line is made up of one or many inline elements (HTML tags or anonymous inline elements for text content) and is called a line-box. When a element is rendered on screen, it can be composed of many lines, according to its width. As a result, 1ex = 49px and 1em = 100px, not 164px (thankfully, em is based on font-size, not computed height) Catamaran font: UPM -Units Per Em- and pixels equivalent using font-size: 100pxīefore going deeper, a short note on what this it involves. We can also predict that capital letters are 68px high (680 units) and lower case letters (x-height) are 49px high (485 units). You can think of the content-area as the area where the background property applies 2. This computed height defines the content-area of an element and I will refer to this terminology for the rest of the article. That means the Catamaran font uses 1100 + 540 units in a 1000 units em-square, which gives a height of 164px when setting font-size: 100px. We also note that Capital Height is 680 and X height is 485.
#Photoshop centering text vertically mac
After running some tests, it seems that browsers use the HHead Ascent/ Descent values on Mac OS, and Win Ascent/ Descent values on Windows (these values may differ!).

But it can also be 1024, 2048 or anything else. This square uses relative units and is generally set at 1000 units.

The reason lays down inside the font itself. Using the same font-size with different font-families produce elements with various heights: Different font-families, same font-size, give various heightsĮven if we’re aware of that behavior, why font-size: 100px does not create elements with 100px height? I’ve measured and found these values: Helvetica: 115px, Gruppo: 97px and Catamaran: 164px Elements with font-size: 100px have height that varies from 97px to 164pxĪlthough it seems a bit weird at first, it’s totally expected. Look at this simple HTML code, a tag containing 3, each with a different font-family: We know that unitless line-height is font-size relative, but the problem is that font-size: 100px behaves differently across font-families, so is line-height always the same or different? Is it really between 1 and 1.2? And vertical-align, what are its implications regarding line-height?ĭeep dive into a not-so-simple CSS mechanism… Let’s talk about font-size first OK, but what normal is? We often read that it is (or should be) 1, or maybe 1.2, even the CSS spec is unclear on that point. They really are complex, maybe the hardest ones, as they have a major role in the creation of one of the less-known feature of CSS: inline formatting context.įor example, line-height can be set as a length or a unitless value 1, but the default is normal.
#Photoshop centering text vertically how to
So simple that most of us are convinced to fully understand how they work and how to use them.

Line-height and vertical-align are simple CSS properties.
