10

フォーカス時に検索ボックスを左側に展開したい。次のコードは展開されますが、右に向かって展開されます。とにかく左に展開することはありますか?

HTML:

<input type="text" placeholder="search">

CSS:

 input[type="text"] {
    background: #444;
    border: 0 none;
    color: #d7d7d7;
    width:50px;
    padding: 6px 15px 6px 35px;
    -webkit-border-radius: 20px;
    -moz-border-radius: 20px;
    border-radius: 20px;
     margin:3px 12px;
}

input[type="text"]:focus {
    background:#ccc;
    color: #6a6f75;
    width: 120px;    
    margin:3px 12px;
    outline: none;
}

input[type="text"] {
    -webkit-transition: all 0.7s ease 0s;
    -moz-transition: all 0.7s ease 0s;
    -o-transition: all 0.7s ease 0s;
    transition: all 0.7s ease 0s;
}

デモ: http://jsfiddle.net/7ppaS/

4

4 に答える 4

2

コードで Direction:rtl を使用します。

 input[type="text"] {
    background: #444;
    border: 0 none;
    color: #d7d7d7;
    width:50px;
    padding: 6px 15px 6px 35px;
    -webkit-border-radius: 20px;
    -moz-border-radius: 20px;
    border-radius: 20px;
     margin:3px 12px;
    direction:rtl
}

http://jsfiddle.net/7ppaS/8/

于 2013-11-04T11:55:52.543 に答える