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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T04:36:55+00:00 2026-06-09T04:36:55+00:00

The input element by default is size=20 if this is not defined inline or

  • 0

The input element by default is size=”20″ if this is not defined inline or a CSS style rule is attributed to it.

How do you make the default the actual size of the value? For other elements:

<div style="display: inline; width: auto;">
    The box will only fit the width of it's content
</div>

width: auto is all you need. I cannot put a defined width since the value may be longer. For example:

<input id="short" type="text" value="1000" />
<input id="long" type="text" value=" Areally long name is in this input field." />

I want #short to be the size of 1000 (essentially size=”4″ + the padding) but the #long to be as long as needed. These inputs are coming in programatically so I can’t simply put a short class on the one’s I want short and a long class on the one’s I want long. I would really just like it if I could put:

input { width: auto; }

Anyway to do this?

  • 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-09T04:36:56+00:00Added an answer on June 9, 2026 at 4:36 am

    The input element by default is size=”20″

    This “default size” depends on the browser, the version and your OS.
    It is not possible to do this in inline styles.

    the best solution is to set width and padding so it adds up to 100%

    input {
      width: 98%;
      padding: 1%;
    }
    

    then set it to absolute left and right 0

    <fieldset>
        <input type="text" />
    </fieldset>
    

    finally add this css

    <style type="text/css">
        fieldset {
          position: relative;
        }
    
        input {
            position: absolute;
            left: 0;
            right: 0;
        }
    </style>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have this input element: <input type="text" class="textfield" value="" id="subject" name="subject"> Then I have
Form + element: <form id=form action=default.aspx method=post runat=server> <input type=submit id=submit value=Submit runat=server/> </form>
How to set blank default text on input field and clear it when element
Any style for input affects every input element. Is there a way to specify
The default decorator for the Zend_Form_Element_Radio is <label for=type_id-1><input type=radio name=type_id id=type_id-1 value=1>Pack</label> The
I have a css class: input { font-family: Arial, Helvetica, sans-serif; font-size: 10px; border:
I'm styling my input[type=radio]'s with CSS, because I need to replace the default radio
I have simple problem - text input element which has specified 2 CSS attributes,
I have an INPUT element of the TEXT type and I want to perform
I have text input element and an event is fired on blur event and

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.