I'm working on a problem and I've found all the values to make it work and I'm trying to figure out if there's a formula in there I can use.

Here is what I have written out so far.

font size in pixels at (line height percent / 100) and x margin = correct character position

Here are values that I found by trial and error that work:

64px at 1.2 and -14px margin = correct character position

If I use a margin percent these values work:

12px at 1.2 and -0.18% = correct character position
24px at 1.2 and -0.60% = correct character position
36px at 1.2 and -1.12% = correct character position
64px at 1.2 and -2.00% = correct character position

Is there a formula I can get from that information?

Related question if you're interested.

You can test the values here. In the CSS panel find the text, "margin-top", enter a new value and click the run button in the upper left hand corner.

Concrete example:

enter image description here

  • $\begingroup$ You always can get a formula that meets this four couples. Your real question if it will predict properly the next values. I wonder if you got the values right - it seems that the first value is out of order. Is it a positive percentage? $\endgroup$ – Moti Jan 25 '16 at 5:59
  • $\begingroup$ Yes. You can enter the values here, jsfiddle.net/6gLQU/19 and see the results. I've added more details above. Also, I've changed the values a bit to .18 and 1.12 and it still looks correct. I don't know if this makes it easier to predict the next values or not. $\endgroup$ – 1.21 gigawatts Jan 25 '16 at 7:58

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.