2016-11-26 21 views
0

2つのボタンがあり、ボタンのテキストの1つがボタンの中央にありません。ボタンの中央にテキストが配置されていません

.mail_download_csv_btn{ 
 
    width: 100px !important; 
 
    font-size: 12px !important; 
 
} 
 

 
.margin_right_10{ 
 
    margin-right:10px; 
 
    }
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css"> 
 
<button type="button" class="btn btn-info height_30 width_110 mail_download_csv_btn">Download CSV</button> 
 
       <button type="button" class="btn btn-info height_30 width_110 margin_right_10 mail_download_csv_btn">Mail PDF</button> 
 
      

テキストダウンロードCSVはボタンにセンタリングされていません。
助けがあれば助かります。

ありがとうございます。

答えて

1

それが中央に配置され、ちょうどあなたのボタンの幅が限られており、右側にテキストオーバーフロー、変更:

.mail_download_csv_btn{ 
    width: 100px !important; 
    font-size: 12px !important; 
} 

.mail_download_csv_btn{ 
    width: 125px !important; 
    font-size: 12px !important; 
} 

にあなたなら、私は、125pxにwidthをsettedましたボタンを同じ幅にしたい場合は、widthタグを削除してください。私は、ボタンの両方が同じになるように幅たい

.mail_download_csv_btn{ 
 
    width: 125px !important; 
 
    font-size: 12px !important; 
 
} 
 

 
.margin_right_10{ 
 
    margin-right:10px; 
 
    }
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css"> 
 
<button type="button" class="btn btn-info height_30 width_110 mail_download_csv_btn">Download CSV</button> 
 
       <button type="button" class="btn btn-info height_30 width_110 margin_right_10 mail_download_csv_btn">Mail PDF</button>

+0

私は両方のボタンの幅を同じにしたい。だから私は幅を入れている –

+0

私が言ったように、私はちょうど100pxの代わりに125pxに設定されていた – Ultrazz008

0

テキストが小さすぎるボタンに明示的な幅を設定するため、テキストが中央に配置されません。

.mail_download_csv_btnからwidth: 100px !importantを削除し、テキストの中央揃えに必要なスペースが得られます。

enter image description here

あなたはすべてのボタンが同じサイズを持っているしたい場合は、最も広いボタンが別のブラウザになりますどのくらいのスペースを知ることができないとして、あなたは明示的な幅を設定しないでください。 代わりにsetting all buttons to the width of the widest buttonのようなものを試してください。

+0

:幅の広い

例。その理由は私は幅を入れて –

+0

私は私の答えを編集しました。 – Marvin

関連する問題