Question

Hello I have problem ... i want to change the user name and password text box highlight color in login form... and when i click it ,it selected as square but it is not square its rounded here is my code shows my problem....

html:

<div  id="username">
    <form>
        <p><span>UserName:</span>
            <input name="UserName" type="text" size="0" id="box1" >
        </p>
    </form>
</div>


<div class="login_form" id="pass">
    <form>
        <p>
            <span>Password:</span>
            <input  name="lastname" type="password" id="box2">
        </p>
    </form>
</div>

css:

    #pass {
    position: absolute;
    top: 22px;
    left: 963px;
    right: 10%;
    width: 280px;
    height: 62px;
    border-radius: 20px;
    font-family: corbel;
}

#username {
    position:absolute;
    top: 23px;
    left: 709px;
    right: 10%;
    width: 280px;
    height: 61px;
    font-family: corbel;
    border:medium;
    border-color:black;
}


#button {
    position: absolute;
    left: 1170px;
    top: 40px;
    background-color: #FFFFFF;
    font-family:corbel;
}

#loginform {
    position:absolute;
    left:100px
}

#bar{
    position:absolute;
    top:0;
    left:0;
    background-color:black;
}

#login{
    position: absolute;
    top: 42px;
    left: 1202px;
    width: 63px;
    height: 19px;
    background-color: #2799b6;
    text-align: center;
    font-family: corbel;
    border-radius:20px;
    color:#FFF;
    font-size:15px;
    opacity:1;
    -moz-transition:    opacity .5s;
    -o-transition:      opacity .5s;
    -webkit-transition: opacity .5s;
    transition:         opacity .5s;
}

#link {
    text-decoration:none
}

#login:hover {
    opacity:0.7;
    -moz-transition:    opacity .5s;
    -o-transition:      opacity .5s;
    -webkit-transition: opacity .5s;
    transition:         opacity .5s;
}

#box1 {
    border: 2px solid #bfbfbf;
    border-radius:20px;
}

#box2 {
    border: 2px solid #bfbfbf;
    border-radius:20px;
}
Was it helpful?

Solution

I think that using the CSS's focus property should work:

input:focus {
    border: 1px solid #006600;
}

Edit: DEMO [JSFIDDLE]

Update: To remove the default outline (which is yellow), you can set the outline property to none:

input {
   outline:none;
}

Here is the updated fiddle.

OTHER TIPS

Just add the following lines of code to your CSS and this should fix your problem:

input[type=text], /*transition delay*/
textarea {
 -webkit-transition: all 0.35s ease-in-out;
 -moz-transition: all 0.35s ease-in-out;
 -ms-transition: all 0.35s ease-in-out;
 -o-transition: all 0.35s ease-in-out;
 outline: none;
 padding: 3px 0px 3px 3px;
 margin: 5px 1px 3px 0px;
 border: 2px solid #f1f1f1;
}

input[type=text]:focus, /*creates highlight effect*/
textarea:focus {
  box-shadow: 0 0 3px rgba(81, 203, 238, 1);
  padding: 3px 0px 3px 3px;
  margin: 5px 1px 3px 0px;
  border: 1px solid rgba(81, 203, 238, 1);
}

input[type=password], textarea{ /*prevents showing outline border when clicked*/
 outline: 0;
}
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top