【问题标题】:Search form slow show [html] [closed]搜索表单慢显示 [html] [关闭]
【发布时间】:2016-02-16 06:20:58
【问题描述】:

任何人都可以帮我创建这样的搜索表单:

http://gledanjefilmova.net/

我知道 css 中有一些元素,但我忘记了……

【问题讨论】:

    标签: html css


    【解决方案1】:

    要创建这样的效果,您需要为输入字段的宽度和颜色添加一个过渡属性。当该字段具有焦点时,您只需更改宽度和颜色。

    .animated-input {
        background: #000;
        border: none;
        border-radius: 5px;
        width: 40px;
        transition: width 1s, background 1s;
    }
    
    .animated-input:focus {
        background: #fff;
        width: 200px;
    }
    

    这是一个 jsfiddle: https://jsfiddle.net/4v0z4tLL/

    【讨论】:

      【解决方案2】:

      要为任何元素添加慢动作效果,您必须使用 css 中的过渡属性:

      -webkit-transition: width 400ms ease-in;
      transition: width 400ms ease-in;
      

      更多信息请阅读: http://www.w3schools.com/css/css3_transitions.asp

      【讨论】: