2015-12-14 25 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

本來問題沒有那些細節,我已經調整了我的答案。謝謝 –

相關問題