/    Sign up×
Community /Pin to ProfileBookmark

[RESOLVED] background-color in selected text?

How does one set the ‘background-color’ and ‘color’ when you select text on a page? I have tried a few things but so far no luck.

to post a comment
CSS

7 Comments(s)

Copy linkTweet thisAlerts:
@skilled1May 08.2009 — selected text will always be highlighted in blue, and white
Copy linkTweet thisAlerts:
@DasherauthorMay 08.2009 — Most pages I select text on are black and gray,

I have seen a few pages where they are red background and white text. < Can't figure out how to do that.
Copy linkTweet thisAlerts:
@skilled1May 08.2009 — do you have an example of this, or something to better explain what you are trying to say?
Copy linkTweet thisAlerts:
@DasherauthorMay 09.2009 — When you are on a web site and you want to highlight some text so you can CTRL-C it (i.e copy it), the background color changes to show you that it is indeed selected.

I was on a web site the other day, that when you selected the text the background color was red and the foreground (text) was white. If I select this text or a portion of it the background is gray, and the foreground (text color) remains black. Basically the colors change just like links could be made to look though CSS, but instead of being a link it is just text.

Unfortunately I did not bookmark this website.

I tried a few things like;

[CODE]
p:link {background-color:red;}

body:link {background-color:red;}

body:active {background-color:red;}

li:active {background-color:yellow;}

[/CODE]


I could color a whole paragraph or list-item, but not just the desired text. That is the text that I high-light by clicking and dragging across some text.
Copy linkTweet thisAlerts:
@DasherauthorMay 09.2009 — Fang: Thanks! Exactly what I was looking for.

Interesting syntax with the double ::


OT: Is it just me or has this web site response times gotten very very long?
Copy linkTweet thisAlerts:
@FangMay 10.2009 — OT: Is it just me or has this web site response times gotten very very long?[/QUOTE]Reply to question or server response?
×

Success!

Help @Dasher spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 5.12,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @AriseFacilitySolutions09,
tipped: article
amount: 1000 SATS,

tipper: @Yussuf4331,
tipped: article
amount: 1000 SATS,

tipper: @darkwebsites540,
tipped: article
amount: 10 SATS,
)...