Textbox highlight color html

Posted on 2007-03-31
Medium Priority
Last Modified: 2012-05-05
Does anyone know how to change the highlight color in a textbox on a webpage ?  Standard highlight colors are dark blue background and white text.  I would like to be able to modify these if possible.
Question by:cannonarm
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 5
  • 3
LVL 36

Expert Comment

ID: 18830064
I know of no way to do this with CSS. Highlight colors are controlled by the operating system and maybe the browser. You might try changing the color of the font to see if the highlight color changes, or change the background of the text box, but that is not the same thing.
LVL 29

Accepted Solution

rdivilbiss earned 600 total points
ID: 18831028
With a little JavaScript and CSS you could do this.  In this page if you enter text in the field and select it it will change colors.


<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>New Page 1</title>
<script type="text/javascript">
function changeColor(oFld) {
      oFld.style.color= "#FFFFFF";
      oFld.style.backgroundColor = "#000088";



<p><input type="text" name="T1" size="20" onselect="changeColor(this)"></p>



Author Comment

ID: 18842840
Sorry rdivilbiss, that code does change colors of the text box and text , but I could not control the highlight colors with that code.  I have to give credit to Zyloch, I do not think it can be done with CSS.

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

LVL 29

Expert Comment

ID: 18843096
Works in IE, FF, & Opera...

Here is a live example with screen shots.
LVL 36

Expert Comment

ID: 18846695

Changing the background color of the field is similar to, but not exactly the same as changing the highlight color, unless I'm mistaken.
LVL 29

Expert Comment

ID: 18846795
What the fore, and back colors are directly affect the highlight (selected) color in almost all browsers.  I'm just setting them temporarily (while selected) to get the desired effect.  It isn't always easy to determine what highlight colors you'll get from a given set of fore and back colors.  It may or may not be feasible for the asker's intent, and it is very limited.  Just not impossible.

I see I forgot the link above: http://www.rodsdot.com/temp_testing/highlight-text-on-select.htm
LVL 36

Assisted Solution

Zyloch earned 400 total points
ID: 18846843
I have only really seen two different highlight colors--the navy and the white, but I see your point.
LVL 29

Expert Comment

ID: 18847721
I would never do this on a production web site.

I hate colored scroll bars and inputs.
LVL 29

Expert Comment

ID: 24092401
no opinion

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Use these top 10 tips to master the art of email signature design. Create an email signature design that will easily wow recipients, promote your brand and highlight your professionalism.
Not sure what the best email signature size is? Are you worried about email signature image size? Follow this best practice guide.
In this tutorial viewers will learn how to style elements, such a divs, with a "drop shadow" effect using the CSS box-shadow property Start with a normal styled element, such as a div.: In the element's style, type the box shadow property: "box-shad…
Learn how to create flexible layouts using relative units in CSS.  New relative units added in CSS3 include vw(viewports width), vh(viewports height), vmin(minimum of viewports height and width), and vmax (maximum of viewports height and width).
Suggested Courses

777 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question