2017-04-27 78 views

回答

1

我想你問的,如文本輸出方法,這裏是得到它的方式..

HTML:

<div> 
    <input type="text" class="inputText" required/> 
    <span class="floating-label">Your email address</span> 
    </div> 

的CSS:

input:focus ~ .floating-label, 
input:not(:focus):valid ~ .floating-label{ 
    top: 0px; 
    bottom: 10px; 
    left: 20px; 
    font-size: 6px; 
    opacity: 1; 
} 

.inputText { 
    font-size: 14px; 
    width: 200px; 
    height: 35px; 
} 

.floating-label { 
    position: absolute; 
    pointer-events: none; 
    left: 20px; 
    top: 18px; 
    transition: 0.2s ease all; 
} 
+2

謝謝@Mani Raj,會檢查代碼。 – JasL

+1

歡迎@JasL .. –