CSS/HTML: Create a glowing border around an Input Field

后端 未结 11 2361
野的像风
野的像风 2020-12-02 03:39

I want to create some decent inputs for my form, and I would really like to know how TWITTER does their glowing border around their inputs.

Example/Picture of the Tw

相关标签:
11条回答
  • 2020-12-02 04:32

    Here you go:

    .glowing-border {
        border: 2px solid #dadada;
        border-radius: 7px;
    }
    
    .glowing-border:focus { 
        outline: none;
        border-color: #9ecaed;
        box-shadow: 0 0 10px #9ecaed;
    }
    

    Live demo: http://jsfiddle.net/simevidas/CXUpm/1/show/

    (to view the code for the demo, remove "show/" from the URL)

    label { 
        display:block;
        margin:20px;
        width:420px;
        overflow:auto;
        font-family:sans-serif;
        font-size:20px;
        color:#444;
        text-shadow:0 0 2px #ffffd;
        padding:20px 10px 10px 0;
    }
    
    input {
        float:right;
        width:200px;
        border:2px solid #dadada;
        border-radius:7px;
        font-size:20px;
        padding:5px;
        margin-top:-10px;    
    }
    
    input:focus { 
        outline:none;
        border-color:#9ecaed;
        box-shadow:0 0 10px #9ecaed;
    }
    <label> Aktuelles Passwort: <input type="password"> </label>
    <label> Neues Passwort: <input type="password"> </label>

    0 讨论(0)
  • 2020-12-02 04:32
    input[type="text"]{
       @include transition(all 0.30s ease-in-out);
      outline: none;
      padding: 3px 0px 3px 3px;
      margin: 5px 1px 3px 0px;
      border: 1px solid #DDDDDD;
    }
    input[type="text"]:focus{
      @include box-shadow(0 0 5px rgba(81, 203, 238, 1));
      -webkit-box-shadow: 0px 0px 5px #007eff;  
      -moz-box-shadow: 0px 0px 5px #007eff;  
      box-shadow: 0px 0px 5px #007eff;
    }
    
    0 讨论(0)
  • 2020-12-02 04:34

    You better use Twitter Bootstrap which contains all of this nice stuff inside. Particularly here is exactly what you want.

    In addition, you can use different themes built for Twitter Bootstrap from this website

    0 讨论(0)
  • 2020-12-02 04:35

    How about something like this... http://jsfiddle.net/UnsungHero97/Qwpq4/1207/

    enter image description here

    CSS

    input {
        border: 1px solid #4195fc; /* some kind of blue border */
    
        /* other CSS styles */
    
        /* round the corners */
        -webkit-border-radius: 4px;
           -moz-border-radius: 4px;
                border-radius: 4px;
    
    
        /* make it glow! */
        -webkit-box-shadow: 0px 0px 4px #4195fc;
           -moz-box-shadow: 0px 0px 4px #4195fc;
                box-shadow: 0px 0px 4px #4195fc; /* some variation of blue for the shadow */
    
    }
    
    0 讨论(0)
  • 2020-12-02 04:36

    SLaks hit the nail on the head but you might want to look over the changes for inputs in CSS3 in general. Rounded corners and box-shadow are both new features in CSS3 and will let you do exactly what you're looking for. One of my personal favorite links for CSS3/HTML5 is http://diveintohtml5.ep.io/ .

    0 讨论(0)
提交回复
热议问题