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 8652001
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T14:12:20+00:00 2026-06-12T14:12:20+00:00

The powers that be have asked for the input fields on some of our

  • 0

The powers that be have asked for the input fields on some of our forms to have bold text. The problem is that the naive way of doing this in the style sheet:

input {
    font-weight: bold;
}

Using this HTML:

1234567890
<input type="text" maxlength="10" size="10" value="1234567890"/>

Caused an immediate problem: now all of the input boxes are too wide.

notice the extra spaces

I’ve narrowed it down to the Yahoo reset which tells the input boxes to font: inherit from the parent (the document body). This is the behavior I want — the input boxes to have the same font as the parent body. But as soon as I specify the font, or use the inherit, the input boxes are too wide again. This is the same in IE and Firefox, so it’s probably not a browser compatibility problem.

See it in action: http://jsfiddle.net/clintp/bZChP/3/

How do I specify the font for the input boxes, but have them sized appropriately?

Update: “Appropriately” http://jsfiddle.net/clintp/bZChP/5/ The input widget on the right is sized appropriately for its data, the one on the left is not. The goal is to have both boxes with the same sizing, same text font [with one being bold!], without having to specify the box size for each and every input box in the application field by field. (There are thousands.)

  • 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-06-12T14:12:21+00:00Added an answer on June 12, 2026 at 2:12 pm

    You cannot, in practice, size input fields reliably unless you use a monospace. Even for monopace fonts, browser have bugs in calculating the field width. The most consistent results are probably achieved if you set the visible width in HTML only, with the the size attribute, and you set the font size and family in CSS, listing down monospace fonts that seem to work OK. E.g.,

    input { font: 100% Lucida Console, monospace; }

    This would address the problem that on some browsers, e.g. <input size=10> results in a field that is about 12 characters wide.

    As regards to the requirement that input boxes have the same font as the parent body, well, then you need to use monospace font in the parent too. ☺ Seriously, although we should be able to set the width of an input field using a proportional font, too, things just don’t work. Even browsers that support the ch unit (which would the issue for numeric input, if it worked) do that inconsistently and incorrectly, so that setting e.g. width: 10ch does not give correct rendering even for the input 0000000000.

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

Sidebar

Related Questions

I have an ASP.NET forms app that allows users to run some management reports.
Have come against an interesting problem and I'm stumped. Basically on one of our
I have an old Asp classic CMS application that powers several websites. It uses
I'm trying to write some code that calculates powers of 2 but stores them
I have a wrapper procedure(proc_main) that calls some procedures within. create or replace Procedure
I have a professor that doesn't understand source control very well. He asked us
I have an asp.net web app that uses forms-based authentication, a SqlMembershipProvider (using an
We have a company intranet and the powers that be think it would be
I have a form with a checkbox that's used to filter some search results.
I'm just curious. Is there a reason why the higher powers that be have

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.