2015-12-14 24 views
5

我对IE9浏览器中的CSS问题感到非常困惑。我有一个网页textareaplaceholder。我想text-align: center;只是占位,:-ms-input-placeholder在Windows 7操作系统中的IE9中不工作

enter image description here

输入文字的text-align设置为left。

enter image description here

下面请看看我的编辑。

的Html

<!DOCTYPE html> 
<html xmlns="http://www.w3.org/1999/xhtml"> 
<head> 
    <title></title> 
    <style> 
     textarea { 
      width: 80%; 
      height: 80px; 
     } 

     ::-webkit-input-placeholder { 
      text-align: center; 
     } 

     :-moz-placeholder { 
      text-align: center; 
     } 

     ::-moz-placeholder { 
      text-align: center; 
     } 

     :-ms-input-placeholder { 
      text-align: center; 
     } 
    </style> 
</head> 
<body> 
    <textarea rows="2" cols="21" id='txtnote' class="testplaceholder" maxlength="500" placeholder="Note" onblur=""></textarea> 
</body> 
</html> 

一切都在工作正常IE 11,火狐,Chrome在Windows 8,但是当我到IE9在Windows看看这个网页7 它不工作

+0

如果我的回答是正确的,请接受它。 –

回答

0

根据MSDN,为了使此选择器工作,您至少需要IE 10。此外,经过进一步调查 - 因为它是在IE9中不支持,还有其他的解决方法来让它按照需要工作。

请检查这SO answer或这alternative JS here

+0

而这正好解决了IE的问题? -ms-前缀已经在那里,所以这个答案充其量只能解决其他浏览器,同时方便地忽略了问题的主题 - IE。 – BoltClock

+0

本来问题没有那些细节,我已经调整了我的答案。谢谢 –

相关问题