Text text CSS = PS - (line-height_1 - 0.7 * font-size_1) / 2 Text border CSS = PS - (line-height - 0.7 * font-size) / 2 The question is, is there a simpler way? О_о But here the situation is simpler, the real height of the paragraph in the CSS will be: height = line-height * num_of_lines Similarly, we can not rely on the correct definition of the height of a paragraph in several lines by Photoshop. Or between two paragraphs: CSS = PS - (0.15 * font-size_1 + (line-height_1 - font-size_1) / 2) And now I use the formula: CSS = PS - (0.15 * font-size + (line-height - font-size) / 2) I calculated that the difference between the real height of the line and the font size is about 30% or 15% at the top and bottom of the text (I'm not saying this is 100% true!). The actual height of the line (obtained with the selection tool) in Photoshop is even less than the font size!Īlthough the photoshop still considers the height of the element to be approximately equal to the font size, which does not affect the distance to it :(. For the distance between two paragraphs we use, respectively: CSS = PS - (line-height_1 - font-size_1) / 2 - (line-height_2 - font-size_2) / 2Īs the font size increases, it becomes clear that this formula is not enough. This is the distance from some obvious border (line) to the text element. Or shorter: CSS = PS - (line-height - font-size) / 2 Therefore, the first recommendation I found is to use the formula: margin_in_CSS = distance_in_PS - (line-height - font-size) / 2 Distances are measured, for example, using smart guides:Īll because the line height is not used in the distances calculation.
![add border to text photoshop elements add border to text photoshop elements](https://helpx.adobe.com/in/photoshop/how-to/add-border-frame-around-photo/_jcr_content/main-pars/image_1179030241.img.jpg)
![add border to text photoshop elements add border to text photoshop elements](http://3.bp.blogspot.com/-h3kz_drxe5I/TudVXbZEpZI/AAAAAAAAND0/J8zeWMY0Jss/s1600/Frame+applied+to+a+photograph+in+Adobe+Photoshop+Elements.png)
#Add border to text photoshop elements how to#
How to convert the distance from/to the text in Photoshop into CSS margin/padding?ĭistances from text elements (paragraphs) in Photoshop do not correspond to margins/paddings in the CSS.
![add border to text photoshop elements add border to text photoshop elements](https://i.pinimg.com/originals/cb/ba/5a/cbba5afc8ec3aa5e4b6b3d83481d3153.png)
How to get CSS text margin/padding from the Photoshop?