locked
Chrome vs IE textbox default behavior RRS feed

  • Question

  • User-1345293485 posted

    Hi,

    I would like to clarify if my findings are correct.
    When the contents of a textbox exceeds the length of the textbox and it loses focus, the behavior of the textbox in Chrome and IE are different.

    I created an ASP project with an aspx page with one asp textbox of width 50px. I enter a piece of text "123456789" that exceeds the length of the textbox and click outside of the textbox to make it lose focus. 

    Chrome behavior:
    It shows the beginning of the text.
    Chrome

    IE behavior:
    It shows the last position of the cursor in the text.
    IE

    Am I correct to assume that these are the default behaviors of the browsers?

    Thursday, December 13, 2018 3:22 AM

Answers

  • User-271186128 posted

    Hi JasonChin,

    You could use F12 developer tools to check the CSS style, then, you can find that the issue is related to the text-align CSS property. 

    When using the Chrome browser, the user agent will add the following css style (include the text-align css property):

    But in IE/Edge browser, they will not add the user agent css style, just contains the inline style. Like this:

    So, the behavior is different.

    Besides, with refer to this article, we can see that IE/Edge browser not support the text-align: start.

    Best regards,
    Dillion

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Friday, December 14, 2018 8:12 AM