2016-08-08 64 views
0

簡單的問題(我希望):無法更改CSS顏色屬性已禁用文本輸入字段

在IE 11(11.0.11),我嘗試使用CSS來獲得禁用的文本顏色html輸入字段不會變灰(即黑色)。在這一努力中,我發現這個例子/教程:http://askthecssguy.com/articles/shawn-asks-the-css-guy-about-styling-disabled-text-inputs/

當我通過點擊這個參考,我看到:enter image description here

但是當我做「節目源」,那麼所有源複製到一個新的(本地)文件,然後打開它,輸入框文本仍然是灰色的。

enter image description here

所以我的問題是:這種負荷的一個方面/從互聯網或東西,我在創建本地文件或其他一些配置已經錯過了顯示它關掉我的本地機器的主場迎戰那可以解決這個問題?

CNC中

下面是HTML:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" 
 
      "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> 
 
    <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"> 
 
    <head> 
 
    \t <meta http-equiv="content-type" content="text/html; charset=utf-8" /> 
 
    \t <title>Disabled Text Boxes</title> 
 
    
 
    <style type="text/css"> 
 
    fieldset {border:0;margin-bottom:12px;} 
 
    label {font:normal 13px/19px verdana;display:block;} 
 
    input {border:1px solid #000;} 
 
    input[disabled='disabled'] { 
 
    \t background:yellow; 
 
    \t color:blue; 
 
    \t cursor:default; 
 
    } 
 
    input.disabled { 
 
    \t background:yellow; 
 
    \t color:blue; 
 
    \t cursor:default; 
 
      font-size:24px; 
 
    } 
 
    </style> 
 
    
 
    
 
    
 
    
 
    </head> 
 
    <body> 
 
    
 
    <fieldset> 
 
    <label for="username">Enabled:</label> 
 
    <input 
 
    \t type="text" 
 
    \t id="username" /> 
 
    </fieldset> 
 
    
 
    <fieldset> 
 
    <label for="dis">Disabled text box using input[disabled='disabled']:</label> 
 
    <input 
 
    \t type="text" 
 
    \t id="dis" 
 
    \t disabled="disabled" 
 
    \t value="you cant edit this" /> 
 
    </fieldset> 
 
    </fieldset> 
 
    
 
    <fieldset> 
 
    <label for="dis">Disabled text box using class="disabled" in CSS:</label> 
 
    <input 
 
    \t type="text" 
 
    \t id="dis" 
 
    \t disabled="disabled" 
 
    \t class="disabled" 
 
    \t value="you cant edit this" /> 
 
    </fieldset> 
 
    </fieldset> 
 
    
 
    </body> 
 
    </html>

添加font-size:24px;輸入[禁用= '禁用']不改變樣式。當我加入font-size:24px;輸入:禁用,所產生的渲染看起來像 enter image description here

感謝

+0

它工作正常,我的機器上。這可能不是這種情況,但是你可能錯過了這個嗎?輸入[disabled ='disabled'] { \t background:yellow; \t顏色:藍色;遊標:默認; \t遊標:默認; } – Vcasso

+0

@ Valius79不,不會錯過它。我知道,因爲我嘗試設置字體大小:... PX,並且工作。這只是'顏色',不起作用。你能確認你使用IE 11嗎? – ControlAltDel

+0

發佈您在本地機器上的實際代碼 –

回答

相關問題