要让<input type="button" />中的文字垂直居中,可有两种办法:

  1:CSS设定样式

  <style type="text/css">

    input.btn_normal{border:1px; background:lightblue; font-size:12px; color:red; padding-bottom:0px; padding-top:3px; cursor:pointer}

  </style>

 

  <input type="button" class="btn_normal" value="确定" />

  利用CSS的padding来使文字垂直居中,首先padding-bottom设置位0,而padding-top则根据实际情况进行设置,肯定会有一个恰当的值会使得文字恰好

垂直居中。

 

  2:插入背景图片

  相比于上面的方法,本方法更为常用:先设计好背景图片,包含按钮中要显示的文字,然后将其设置为按钮的背景图片即可。

  <input type="button" value="确定" style="background:url('/img/1.gif')" />

  

相关文章:

  • 2021-06-24
  • 2022-12-23
  • 2022-12-23
  • 2022-01-08
  • 2021-10-09
  • 2022-02-17
猜你喜欢
  • 2021-09-08
  • 2021-11-19
  • 2021-09-21
  • 2022-12-23
  • 2021-07-04
  • 2022-12-23
  • 2021-10-29
相关资源
相似解决方案