我的HTML前端側部分被這樣表示:垂直集中的對象與CSS
<div class="input_wrap">
<input type="text" title="money" class="input_text price" name="amount"
onkeyup="this.value=this.value.replace(/[^\d]/,'');
this.value=make_price_format(this.value);"
onblur="this.value=this.value.replace(/[^\d]/,'');
this.value=make_price_format(this.value);">
<span class="unit">Euro</span>
</div>
正如你看到的,有一個文本框,並在它旁邊,有一個span.unit
「歐元」。
對應的CSS如下所示。
#register_apply .apply_table .input_wrap span.unit
{
vertical-align:middle;
text-align:center;
padding-top:30px;
margin-top:30px;
font-size:22px;
color:#646464;
}
#register_apply
和apply_table
是上層階級的名字。正如你所看到的,我增加了一些屬性,使歐元垂直放置在中間位置。由於文本框高度爲60px
,我想從頂部放置「歐元」大約30px
的位置。但我無法通過margin
和padding
控制位置。
接下來我該做什麼?
@akash除非你給他們'display:inline-block;'那就是。 – AlexG