Why changing visibility/display on focus does not work?

前端 未结 4 1033
独厮守ぢ
独厮守ぢ 2020-12-11 05:01

I\'ve gotten an idea to make a search \"button\" upon clicking which the input box would show up and stretch. However instead of using an invisible checkbox I decided to try

4条回答
  •  半阙折子戏
    2020-12-11 05:18

    Fiddle: http://jsfiddle.net/h6NNs/

    Change from :focus to :hover.

    Resulting CSS should be:

    form label {
        font-size: 23px;
    }
    
    #box {
        width: 0px;
        visibility: hidden;
        opacity: 0;
    
        -webkit-transition: 200ms;
        -moz-transition: 200ms;
        -ms-transition: 200ms;
        -o-transition: 200ms;
        transition: 200ms;        
    }
    
    #box:hover{
        visibility: visible;
        opacity: 1;    
        width: 50px;
    }
    

提交回复
热议问题