Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6913555
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T09:14:01+00:00 2026-05-27T09:14:01+00:00

I use pixel setting of font size in my CSS-code. for example: .items {

  • 0

I use pixel setting of font size in my CSS-code.
for example:

.items {
    font-family: Verdana, Arial;
    font-size: 14px;
    width: 100px;
}

I have a problem. For example there are words Hello words written in element of class .items. Element fits in 100px and is displayed OK (in Ubuntu Linux). But in Windows browsers fonts are wider and text doesn’t fit in 100px, so 2 lines of text appear (that I don’t want to be)

How to protect your site from such problems? How to be sure, that every text in elements fits its container?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-27T09:14:02+00:00Added an answer on May 27, 2026 at 9:14 am

    You might try to protect from such problems by setting a large enough width. But there is no way to guarantee that some width is always sufficient, and if the width is sufficient in most cases, then it is far too large in many cases.

    The width of text depends on many things, not just on font size (which has no simple relationship to the width)—characteristics of the font (advance widths of characters), the actual text (say, many m’s vs. many i’s), and in principle letter spacing and word spacing too. It does not depend on operating system, though different systems may have different common fonts. It indirectly depends on language, since different languages use different writing systems, whereby widths of letters may vary a lot.

    Using em instead of px has several benefits, but it does not help in this issue. The em unit is the height of the font and cannot be used to evaluate the width of characters.

    So you just have to live with this. For example, if you wish to set up a vertical navigation bar where the links (presented in button-like manner or otherwise with their width visible), a single-column table is the practical solution, since it results in a presentation where all cells are of equal width, determined by the cell with largest width requirements.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I use this reset. * { font-family: Arial, Helvetica, sans-serif; outline: 0; padding: 0;
Does setWidth(int pixels) use device independent pixel or physical pixel as unit? For example,
What pixel format (RGBA, ARBG, BGRA) does the X server use? If any specific
My main browsers (FF and Chrome) are both configured for a 12 pixel font.
What I am doing is getting the pixel size of a string and converting
I am working on an application, which has to use pixel manipulation in the
I am Plotting a pixel on the screen from the following code using Assembly
'''use Jython''' import shutil print dir(shutil) There is no, shutil.move, how does one move
Use case: A does something on his box and gots stuck. He asks B
Use case: 3rd party application wants to programatically monitor a text file being generated

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.