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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 13, 20262026-05-13T22:25:14+00:00 2026-05-13T22:25:14+00:00

1) If textbox element ( <input type=text /> ) has its width property set

  • 0

1) If textbox element (<input type=”text” /> ) has its width property set to inherit, then textbox doesn’t overflow. But if textbox has width set to auto, then it overflows due to browser calculating the width.

a) Why doesn’t browser take into the account that textbox is inside another element and thus adjusts the width of a textbox accordingly?

b) Based on what parameters does it decide what the width of a textbox should be?

<html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en">
  <head> 
    <style type="text/css">
       p
       {
         width:60px;
       }
    </style>
 </head>
 <body>
       <p>
         <input type=”text” />
       </p>
 </body>
</html>

2) Do all Html elements by default have their width value set to auto?

thanx

  • 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-13T22:25:15+00:00Added an answer on May 13, 2026 at 10:25 pm

    You can find various rules for calculating the width for width:auto here.


    Regarding inherit:

    Each property may also have a specified value of ‘inherit’, which means that, for a given element, the property takes the same computed value as the property for the element’s parent.

    So width:inherit means it takes the same computed width as the parent element.


    Regarding width:auto on inline elements:

    If ‘height’ and ‘width’ both have computed values of ‘auto’ and the element also has an intrinsic width, then that intrinsic width is the used value of ‘width’.

    If ‘height’ and ‘width’ both have computed values of ‘auto’ and the element has no intrinsic width, but does have an intrinsic height and intrinsic ratio; or if ‘width’ has a computed value of ‘auto’, ‘height’ has some other computed value, and the element does have an intrinsic ratio; then the used value of ‘width’ is:

    (used height) * (intrinsic ratio)

    If ‘height’ and ‘width’ both have computed values of ‘auto’ and the element has an intrinsic ratio but no intrinsic height or width and the containing block’s width does not itself depend on the replaced element’s width, then the used value of ‘width’ is calculated from the constraint equation used for block-level, non-replaced elements in normal flow.

    Otherwise, if ‘width’ has a computed value of ‘auto’, and the element has an intrinsic width, then that intrinsic width is the used value of ‘width’.

    Otherwise, if ‘width’ has a computed value of ‘auto’, but none of the conditions above are met, then the used value of ‘width’ becomes 300px. If 300px is too wide to fit the device, UAs should use the width of the largest rectangle that has a 2:1 ratio and fits the device instead.

    So for inline elements in many cases, the “intrinsic” width of the element is used (even if this is wider than the parent element).

    Note that there are different rules for block-level and floating elements, but <input> is naturally an inline element


    width:auto is the default value

    ‘width’
    Value: <length> | <percentage> | auto | inherit
    Initial: auto

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

Sidebar

Related Questions

I want to set a text on a textfield / textbox element with the
I want to create a input textbox that does not require a <input type=text>
I would like to know when any input element on my Window has its
I have a TextBox input element that has a RequiredFieldValidator as such: <div> <label>First
I'm using the simple code below to replace a textbox ( <input type=text />
I'm having problem automating to type the text in the textbox with variable id's
I have a page that contains an element (a TextBox) that has two CSS
I want to add style in ASP.NET textbox control. I couldn't find textbox element
How to check if an html element [textbox, select, radiobutton etc] is in a
I want to access the text elements inside this textbox in GWT from the

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.