Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Make glowing effect around the text box while active

Tags:

html

css

xhtml

Make glowing effect around the text box while placing the cursor inside the textbox. For example : just place the cursor inside the search textbox in our stackoverflow.com.

Its because of css, but i dont know how to achieve it.. Please help me.

like image 234
praveenjayapal Avatar asked Jun 15 '09 14:06

praveenjayapal


People also ask

How do you add glowing effects to text in CSS?

The CSS glowing text can be created by using the text-shadow property. This property allows you to add different shadows to your text. You can also place your text in an element and then apply the shadow effect to it by using the box-shadow property with some animations.

How do you make a glow border?

In this tutorial, you'll find some methods of creating a glowing border around an input field with CSS properties. In the example below, we add the :focus pseudo-class to the <input> element and then, specify the border-color and box-shadow properties. Also, we set the outline property to “none”.


2 Answers

Instead of outlines, the box-shadow property achieves a very smooth, nice effect of any text field:

field {
    border-color: #dbdbdb;
}

field:focus { /* When you click on the field... */
    border-color: #6EA2DE;
    box-shadow: 0px 0px 10px #6EA2DE;
}

Here's a JSFiddle Demo I once made myself showing the above code with a transition fade effect.

like image 158
beakr Avatar answered Oct 21 '22 15:10

beakr


While the effect you observe on the stackoverflow search box is probably browser specific (e.g. Google Chrome) there is a way to achieve what you want using the CSS :focus pseudo class:

#foo:focus { border: 2px solid red; }
<input id="foo" type="text"/>
like image 31
Josef Pfleger Avatar answered Oct 21 '22 17:10

Josef Pfleger