Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to set <input> border

Tags:

html

css

I am not sure how to call this kind of feature but my question is, is there a way to set the color of the following effect:

enter image description here

Using just border doesn't make it.

like image 900
UpCat Avatar asked Mar 21 '26 04:03

UpCat


1 Answers

Use the outline property:

input:focus { outline: 2px orange solid }

outline works in all modern browsers except for IE < 8.

The :focus pseudo-class works in all modern browsers except IE - you would have to use a JavaScript workaround for that as shown here.

However, you will not be able to duplicate the desired effect (which seems to be Chrome's default behaviour when focusing on a field?) entirely because outline doesn't have a radius property. Maybe @Sarfraz' suggestion is a suitable workaround for that.

like image 103
Pekka Avatar answered Mar 22 '26 19:03

Pekka



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!