Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to change border color on focus? [closed]

Tags:

html

css

forms

By clicking inside the input field or focus on the input field, how to change the border color.

HTML

<div className="col-md-12">
   <div className="form-group">
      <label for="Street_Address">Street address</label>
      <input type="text" className="form-control" id="Street_Address"  placeholder="" />
   </div>
</div>

CSS

input:focus
{
    border: 1px solid #1670BE;
    box-shadow: 0 0 3px #1670BE;
    outline-offset: 0px;
    outline: none;
}
like image 270
Cris Avatar asked Jun 08 '11 04:06

Cris


People also ask

How do you change the border color in text area?

Change the border colorOn the Drawing Tools Format tab, click Shape Outline and, under Theme Colors, pick the color you want. Select the shape or text box.


3 Answers

Try this:

input[type="text"], input[type="password"], textarea, select { 
    outline: none;
}

When the element is focussed, the User Agent (browser) by default sets an outline. So, to prevent it, you need to override it as shown above

like image 196
Petah Avatar answered Oct 11 '22 22:10

Petah


try this also.

*:focus {
    outline: none;
}
like image 34
Indrajith_kb Avatar answered Oct 11 '22 20:10

Indrajith_kb


Sometimes what looks like a border is really a border shadow as in the case of Bootstrap, so you would use:

#myelement:focus {
    box-shadow: none;
}
like image 22
Peter Drinnan Avatar answered Oct 11 '22 20:10

Peter Drinnan