Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to change border color of textarea on :focus

Tags:

html

css

People also ask

How do you change the textbox border color on focus in react native?

import { Platform, StyleSheet, Text, View, TextInput } from "react-native"; Step-3 : Create TextInput component inside the render block and specify borderWidth, borderColor property of CSS Stylesheet in TextInput Component. This CSS property will set the border color in TextInput layout.

How do you change the focus color in HTML?

Use the :focus class to change the color of focused links. Possible values could be any color name in any valid format.


.input:focus {
    outline: none !important;
    border:1px solid red;
    box-shadow: 0 0 10px #719ECE;
  }

There is an input:focus as there is a textarea:focus

    input:focus { 
        outline: none !important;
        border-color: #719ECE;
        box-shadow: 0 0 10px #719ECE;
    }
    textarea:focus { 
        outline: none !important;
        border-color: #719ECE;
        box-shadow: 0 0 10px #719ECE;
    }

Probably a more appropriate way of changing outline color is using the outline-color CSS rule.

textarea {
  outline-color: #719ECE;
}

or for input

input {
  outline-color: #719ECE;
}

box-shadow isn't quite the same thing and it may look different than the outline, especially if you apply custom styling to your element.


so simple :

 outline-color : green!important;

the whole CSS for my react-boostrap button is:

 .custom-btn {
     font-size:1.9em;
     background: #2f5bff;
     border: 2px solid #78e4ff;
     border-radius: 3px;
     padding: 50px 70px;
     outline-color : blue !important;
     text-transform: uppercase;
     user-select: auto;
     -moz-box-shadow: inset 0 0 4px rgba(0,0,0,0.2);
     -webkit-box-shadow: inset 0 0 4px rgba(0, 0, 0, 0.2);
     -webkit-border-radius: 3px;
     -moz-border-radius: 3px;
 }

Try out this probably it will work

input{
outline-color: #fff //your color
outline-style: none // it depend on you 
}

you need just in scss varible

$input-btn-focus-width:       .05rem !default;

You can use CSS's pseudo-class to do that. A pseudo-class is used to define a special state of an element.

there is a ::focus pseudo-class that is used to select the element that has focus. So you can hook it in your CSS like this

Using class

.my-input::focus {
  outline-color: green;
}

Using Id

#my-input::focus {
  outline-color: red;
}

Directly selecting element

input::focus {
  outline-color: blue;
}

Using attribute selector

input[type="text"]::focus {
  outline-color: orange;
}