Reputation: 7030
I have seen in many weblogs when we select text the background color of the text changes rather than usual blue. This Tech Works in Firefox and Safari, is there any method available for Internet Explorer?
Upvotes: 5
Views: 6801
Reputation: 1859
This?
<style>
::selection {color:red;background:yellow;}
::-moz-selection {color:red;background:yellow;}
</style>
http://www.w3schools.com/cssref/tryit.asp?filename=trycss3_selection
Upvotes: 1
Reputation: 151
You could always remove it.
if (window.getSelection) {
if (window.getSelection().empty) { // Chrome
window.getSelection().empty();
} else if (window.getSelection().removeAllRanges) { // Firefox
window.getSelection().removeAllRanges();
}
} else if (document.selection) { // IE?
document.selection.empty();
}
Upvotes: 0
Reputation: 490153
I think it would be difficult to emulate
I think you should use CSS for the browsers that support it, and wait patiently for IE to adopt this.
Upvotes: 0
Reputation: 2583
Not supported on IE as far as I know. Unless there's some clever hack I don't know about.
Upvotes: 0
Reputation: 1173
It can't be done in IE with pure CSS and I don't know of any pre-packaged JS that will get the job done, either.
Upvotes: 1