我在底部有一行輸入字段,非常像教科書的一行。我希望能夠顯示佔位符文本以及用戶輸入的文本稍微在行上方。輸入字段的輸入文本樣式html css
我做了一個小提琴在這裏:http://jsfiddle.net/H7AVP/
這是我的HTML是什麼樣子:
<input type="text" placeholder="subscribe for early access" class="form-control email">
而我的CSS(不跨瀏覽器的問題,優化):
.email::-webkit-input-placeholder {
font-family: 'Open Sans', sans-serif;
font-size: 25px;
padding-bottom:45px;
margin-top:-10px;
}
input {
background-color: #2980b9;
outline: 0;
border-bottom: 2px;
border-top: 0;
border-left: 0;
border-right: 0;
border-bottom-style: double;
border-bottom-color: #34495e;
height: 46px;
width: 300px;
}
input:focus{
outline:0;
}
textarea:focus{
outline:0;
}
所以你想讓文字更接近線條?像這樣:http://jsfiddle.net/H7AVP/1/? –
http://stackoverflow.com/questions/19516303/how-to-keep-input-placeholder-visible-when-user-is-typing查看此信息。 –