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" />
精彩评论