calculate width in px of letter

Discussion in 'CSS' started by thechasboi, Oct 12, 2006.

  1. #1
    Is there a way to calculate the width of a letter in px based upon size, font, bold and such?????

    Thanks for the help and thoughts
     
    thechasboi, Oct 12, 2006 IP
  2. kk5st

    kk5st Prominent Member

    Messages:
    3,497
    Likes Received:
    376
    Best Answers:
    29
    Trophy Points:
    335
    #2
    That's dependent on the font foundry.

    Apparently you've decided that's the solution to some problem, but what is the problem? There may be another solution.

    cheers,

    gary
     
    kk5st, Oct 12, 2006 IP
  3. thechasboi

    thechasboi Guest

    Messages:
    65
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #3
    kk5st

    Thanks again for the reply. I have this application that I designed. It allows the user to manually change the font size then insert into the db with a save. The thing is that the application needs to know the width of the elements the words are in so it can calculate some stuff and then do some stuff. I have already done some research and experimentation to get the perfectly adjusted height but the problem is the width. I could force a width based upon the font size but this would not work if the text changes inside the element. This is why i need this calculation.

    THanks for the reply
     
    thechasboi, Oct 13, 2006 IP
  4. kk5st

    kk5st Prominent Member

    Messages:
    3,497
    Likes Received:
    376
    Best Answers:
    29
    Trophy Points:
    335
    #4
    If you set width in terms of em, it will be proportional to the font size.

    cheers,

    gary
     
    kk5st, Oct 13, 2006 IP