开发者

html text box displaying hint when in focus

开发者 https://www.devze.com 2022-12-16 19:33 出处:网络
How do I create a开发者_Go百科 text box that displays hint on the right when in focus? Example : http://www.airbnb.com/rooms/new

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

精彩评论

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

关注公众号