开发者

html text box displaying hint when in focus

How do I create a开发者_Go百科 text box that displays hint on the right when in focus?

Example : http://www.airbnb.com/rooms/new (click on the address text box)


It's also possible without javascript.

<input type="text" value="Focus me to see a hint!" style="width: 200px; height: 30px;"/>
<div>Congratulations, you found me !</div>

.input + div {
    display: none;
    position: relative;
    top: -30px;
    left: 200px;
}

.input:focus + div {
        display: block;
}

Enjoy ;)


Its is simple with placeholder

<input type="text" placeholder = "your gray text" />
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜