Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 4 of 4
  1. #1
    New Coder
    Join Date
    Feb 2006
    Posts
    44
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Font type having the same width

    Ok basically I'm trying to output information in a 4 by 4 table. However on mobile devices, some browsers by default have the table disabled. So to keep things simple I want to just display the information with proper spacing. Because I know the max amount of data that will be in each location so spacing should be easy. However the font type displayed in the browser might have "1" be very narrow, where as "O" is wider. Is there a way to force font type or make the spacing for any character the same on a mobile browser?

  • #2
    Senior Coder whizard's Avatar
    Join Date
    Jan 2005
    Location
    Philadelphia, PA, USA
    Posts
    1,662
    Thanks
    14
    Thanked 76 Times in 76 Posts
    Wrap it in the <tt></tt> tag.

    HTH
    Dan
    PHP Tip: If you want to use short tags (<? or <?=$var) then make sure short_open_tag is set to "1". It really helps.

    Don't forget to save everyone time and mark your thread as Resolved :)

    "Also note that it is your responsibility to die() if necessary."

    DON'T USE THE MYSQL_ EXTENSION

  • #3
    New Coder
    Join Date
    Feb 2006
    Posts
    44
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Thank you sir, worked like a charm.

  • #4
    Senior Coder Arbitrator's Avatar
    Join Date
    Mar 2006
    Location
    Splendora, Texas, United States of America
    Posts
    3,302
    Thanks
    28
    Thanked 276 Times in 270 Posts
    It works because the typewriter text (tt) element (which should probably be avoided because its use is pretty much always presentational) sets the font to a monospace font family. You can do the same thing with the CSS declaration font-family: monospace. Some specific monospace fonts are Courier, Courier New, Lucida Sans Typewriter, Lucida Console, and Monaco, if you have a preference.
    For every complex problem, there is an answer that is clear, simple, and wrong.


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •