2014-03-31 55 views
3

http://s8.postimg.org/xcxk0e0ud/selection_Bg_Opacity.jpgMake :: selection background opacity:1?

這可能嗎?我希望選定的文字具有堅實的背景,而不是透明的背景。不透明度:1不這樣做,因爲必須有瀏覽器的標準覆蓋(或類似的東西)。

如果js需要參與,我會接受該選項。我只是不是最熟悉它。

HTML:

<div> 
    <h1>HEY!</h1> 
    <p>why is my background not<br/><strong>STARK WHITE</strong><br/>when selected?</p> 
</div> 

CSS:

::-moz-selection { 
    background: #fff; 
    color: #000; 
} 
::selection { 
    background: #fff; 
    color: #000; 
} 
body { 
    color: #fff; 
    font-family: sans-serif; 
    line-height: 2em; 
} 
div { 
    padding: 2em; 
    background: #F8372A; 
    text-align: center; 
} 

http://jsfiddle.net/dare_bare/buC66/

回答