开发者

CSS Issue in IE7 and IE8 - text-indent on <input type="text"> field

Is it possible to make IE7 and IE8 respect the text-indent css property on an开发者_运维百科 input field?

Here's my code

<!DOCTYPE html>
<html>
<body>
        <input type="text" style="text-indent:100px; display:block;" value="Test indent" />
</body>
</html>

When you first load the page in IE8, the text is NOT indented. You can "activate" the text-indent property by focussing in on the text field and typing into it (ie. trigger the onchange event).

How do I make IE7 and IE8 respect the text-indent of an input text element on page load instead of on input.onchange event?


in normal case input tag text-indent does not work in ie6 and ie7 If we add lineheight:1px it will work all browser

Text-indent will work all browser

<input type="text" style="text-indent:-100px; display:block; line-height:1px;" value="Test indent" />

Text-indent not will work ie7 and ie6 browser

<input type="text" style="text-indent:-100px; display:block;" value="Test indent" />

demo

http://jsfiddle.net/KczMR/1/


Are you sure that you want 'text-indent' instead of either the 'margin-left' or the 'padding-left' property? The 'text-indent' property is meant to affect only the first line of text in an element. You might have better luck with margin or padding.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜