2015-09-04 62 views
0

我做了一個簡單的應用程序的形式。我能夠使近90%。但我有一個問題。在我的應用程序,我有標籤,在前面我有文本字段。我需要標籤文本應該是中心或在同一基地佔位符,enter image description here如何將標籤與佔位符對齊?

。我試着給頂:5px的的margin-top:5px的但沒有工作。換句話說 要求標籤應在同一水平文本框的佔位符。

這裏是我的代碼 http://codepen.io/anon/pen/NGPvge

.wrapper{ 
    padding-top:3em; 
} 
.label_title div { 
    text-align: center; 

    margin-top: 1em; 
    position: relative; 

} 

回答

0

添加line-height: 50px;到DIV

.label_title div { 
    line-height:50px; // <- Pull the text down 50px 
    text-align: center; 
    margin-top: 1em; 
    position: relative; 
} 
1

請在

.label_title div { 
    text-align: center; 
    margin-top: 1em; <<<---Remove this 
    line-height: 50px; <<<---Add this 
    position: relative; 
} 

標籤,這些變化將與佔位來對齊。

Fiddle