2014-01-24 35 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

仍然无法工作.. –

相关问题