2016-08-11 5 views
0
<input type="button" class="click" id="click" value="Click" style="width: 45px; margin-top: 1.5%; height: 20px; text-align: center; color: white; background: #23b7e5; font-size: 13px; border-color: #23b7e5; border-radius:2px; padding: 0px; "> 

    <label class="control-label" style="border: thin red solid; margin-top: 10px;">Here to find location</label> 

私は同じ行にボタンとテキストボックスを入れたいのですが、テキストをボタンの中心にしたいのですが。私はこの出力を得る。私は、 "ここで場所を見つける"ボタンの中心にしたい。同じ行とテキストのボタンとテキストをボタンの中心にする

ありがとうございます。 ご協力いただければ幸いです。

+1

共有ボタンコードの両方に同じマージン値を使用する必要があります。.. –

+0

私は質問を更新しました。そこにボタンコードがあります –

答えて

4

display: inline-blockvertical-align:middleは、トリックを行います一度それを試してみてください。

input, label{ 
 
    display: inline-block; 
 
    vertical-align: middle; 
 
    margin: 10px 0; 
 
}
<input type="button" class="click" id="click" value="Click" style="width: 45px; height: 20px; text-align: center; color: white; background: #23b7e5; font-size: 13px; border-color: #23b7e5; border-radius:2px; padding: 0px; "> 
 

 
    <label class="control-label" style="border: thin red solid;">Here to find location</label>

+0

ありがとうございます。出来た。 5分で受け入れる –

0

+0

私はテキストボックスが欲しくありません。 –

0

あなたはマージントップ与えた:1.5%;入力およびマージントップへ:ラベル付けの10pxの、あなたはあまりにも

input{ 
 
    float:left; 
 
    width: 45px; 
 
    margin-top:10px; 
 
    height: 20px; 
 
    text-align: center; 
 
    color: white; 
 
    background: #23b7e5; 
 
    font-size: 13px; 
 
    border-color: #23b7e5; 
 
    border-radius:2px; 
 
    padding: 0px; 
 
    } 
 
.control-label{ 
 
    float:left; 
 
    border: thin red solid; 
 
    margin-top: 10px; 
 
}
<input type="button" class="click" id="click" value="Click" style=""> 
 

 
    <label class="control-label" style="">Here to find location</label>

関連する問題