4

I have an HTML5 input field that displays a clear button with an "x" in it in webkit browsers when the field has characters in it. The problem is that, when the field is filled with characters, these will run behind the x button until they reach the right side of the input before they are scrolled off of the left side of the input.

I want to define the width of the input area in which characters may appear. How is this done in the most cross-browser way possible? (I don't need the x buttons in all browsers, but I don't mind them when they do show up. I just need to define the area an input has available to visible characters so they start to scroll off to the left before they get behind the x buttons)

4

3 に答える 3

1

padding-right CSS プロパティの使用

<input type="text" style="padding-right: 1em; width: 5em;">
于 2013-08-01T16:44:21.163 に答える
1

検索入力について話している場合(私が考えることができる WebKit ブラウザーに小さな表示がある唯一のものを共有していxます)、他の何よりも問題を引き起こすカスタム スタイルを削除することをお勧めします。

input[type="search"]::-webkit-search-decoration,
input[type="search"]::-webkit-search-cancel-button,
input[type="search"]::-webkit-search-results-button,
input[type="search"]::-webkit-search-results-decoration {
    display: none;
}
于 2013-08-01T16:51:40.267 に答える