2013-02-18 78 views
0

這裏:URL第一個字段是40px高,而其他字段是30px。我不明白這是可能的。CSS:爲什麼只有第一個元素的高度不一樣?

我想:

  • 糾正&明白的問題
  • 使所有字段「垂直對齊」(標籤不是垂直居中)。

任何幫助非常感謝!

+0

輸入** ** 30px高**。由於這些輸入,所以''容器** ** 40px高**。 – Vucko 2013-02-18 21:45:31

回答

0

迴應你的第二個問題,給標籤line-height等於旁邊的輸入。你也可以嘗試:

position: relative; 
top: 50%; 
bottom: 50%; 
line-height: 0; 

爲更一般的風格。只需將它應用於.labels或其他東西,而不是單獨設計每個樣式。

+0

謝謝!剩下的唯一問題就是它在我的'Nexus7'上看起來很醜。任何想法如何我可以改變風格來應用'text-align:right;'只在正常屏幕上(=不是手機或平板電腦)? – 2013-02-18 23:00:00

0

從引導下面的CSS增加了10px的保證金您輸入下面:

select, textarea, input[type="text"], input[type="password"], input[type="datetime"], input[type="datetime-local"], input[type="date"], input[type="month"], input[type="time"], input[type="week"], input[type="number"], input[type="email"], input[type="url"], input[type="search"], input[type="tel"], input[type="color"], .uneditable-input { 
    height: 20px; 
    padding: 4px 6px; 
    margin-bottom: 10px; 
} 

我刪除的東西,但20px的高度加上8像素垂直填充,2px的邊境,並10px的利潤率底意味着這將有40像素總總高度。

重寫此樣式,但爲此特定元素添加margin: 0

+0

非常感謝您的解釋。我試圖應用jimjimmy1995的答案,它解決了第二個問題,這對我來說非常重要。再次感謝你 – 2013-02-18 22:58:45

相關問題