2014-01-24 36 views
1

以下是代碼,問題是它在桌面瀏覽器上正常工作,即禁用輸入的紅色,但在移動瀏覽器上,它不顯示紅色,而是顯示爲灰色,任何想法?如何更改/禁用在手機瀏覽器中輸入文字顏色?

<!DOCTYPE HTML> 
<html lang="en"> 
<head> 
    <meta charset="UTF-8"> 
    <title>testing</title> 
    <style> 
    input[disabled] { 
     color: #f55; 
     font-weight: bold; 
    } 
    </style> 
</head> 
<body> 
    <section> 
     <form id="myForm" method="post" action="forms.php"> 
      <input type="text" name="username" value="Username" disabled> <br> 
      <input type="password" name="password" placeholder="Password"> <br> 
      <input type="submit" name="submit"> <br> 
     </form> 
    </section> 
</body> 
</html> 

回答

0
<!DOCTYPE HTML> 
<html lang="en"> 
<head> 
    <meta charset="UTF-8"> 
    <title>testing</title> 
    <style> 
    input[disabled] { 
     color: #f55; 
     font-weight: bold; 
    } 
    @media only screen and (max-width:1000px) { 
     input[disabled]{ 
      color: #C90; 
      font-weight:bold; 
    } 
    </style> 
</head> 
<body> 
    <section> 
     <form id="myForm" method="post" action="forms.php"> 
      <input type="text" name="username" value="Username" disabled> <br> 
      <input type="password" name="password" placeholder="Password"> <br> 
      <input type="submit" name="submit"> <br> 
     </form> 
    </section> 
</body> 
</html> 

您可以使用該媒體查詢,而不是把這種風格的HTML文檔中,將保持外部樣式表長期CSS更合適....您可以根據設定不同的設備@media內部不同設備的最大寬度css

+0

仍然無法工作.. –

相關問題