2014-01-29 44 views
1

目前我有以下代码。背景颜色与文字颜色相同

#Image_ID { 
    color: #000066; 
    font: normal 10pt Verdana, Helvetica, Arial; 
    background: none; 
    border: none; 
} 

这使得我的输入框变白并且摆脱边界。但是,当输入值时,该值是黑色。我想要的是当输入文字时,它与背景颜色相同,因此几乎不可见。

+1

您是否试过改变颜色属性? – j08691

+0

你有我们可以看的演示吗? – GSaunders

回答

6

这应该可以做到。

#Image_ID:focus { 
    color: transparent; 
} 
+0

无法让它工作。但它确实让我有了采用原始代码和改变颜色的想法:#000066颜色:透明;哪些工作! –

+1

@MichaelDowney我很高兴你找到了解决方案! –

5

重申的是,问题是,程序员希望的背景色为相同的元素的指定color自动的方式,而无需手动指定它。

这可以用background propety的currentColor的值很好的把戏来完成。

Live demo hereMDN docs heresupported browsers list here

p{ 
    color  : green; 
    background : currentColor; // will render same as above, "green" 
}