将unicode文本置于按钮中心

时间:2015-04-17 04:48:54

标签: css twitter-bootstrap button unicode

我有一个按钮,我在其中使用bootstrap css,我使用了unicode文本作为按钮,我希望unicode文本的字体大小为30px,按钮高度为34px;但似乎文本不在按钮内。

任何人都可以告诉我一些解决方案吗



<!DOCTYPE html>
<html lang="en">
<head>
  <title>Bootstrap Example</title>
  <meta charset="utf-8">
  <meta name="viewport" content="width=device-width, initial-scale=1">
  <link rel="stylesheet" href="http://maxcdn.bootstrapcdn.com/bootstrap/3.3.4/css/bootstrap.min.css">
  <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js"></script>
  <script src="http://maxcdn.bootstrapcdn.com/bootstrap/3.3.4/js/bootstrap.min.js"></script>
</head>
<body>

<div class="container">
  <button type="button" class="btn btn-primary" style="height: 34px;"><span style="font-size:30px;">&#8649;</span></button>  
</div>
</body>
</html>
&#13;
&#13;
&#13;

1 个答案:

答案 0 :(得分:2)

您可以通过两种方式实现这一目标:

  1. 行高
  2. 删除身高

    更新:在您的css文件中更新/添加

    .btn{
        outline:none !important;
        }
    

    <!DOCTYPE html>
    <html lang="en">
    <head>
      <title>Bootstrap Example</title>
      <meta charset="utf-8">
      <meta name="viewport" content="width=device-width, initial-scale=1">
      <link rel="stylesheet" href="http://maxcdn.bootstrapcdn.com/bootstrap/3.3.4/css/bootstrap.min.css">
      <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js"></script>
      <script src="http://maxcdn.bootstrapcdn.com/bootstrap/3.3.4/js/bootstrap.min.js"></script>
    
    <style>
    .btn{
    outline:none !important;
    }
    </style>
    </head>
    <body>
    
    <div class="container">
      <button type="button" class="btn btn-primary" style="height: 34px; line-height: 16px; vertical-align:middle"><span style="font-size:30px;">&#8649;</span></button>  
    
     <button type="button" class="btn btn-primary" style=" line-height: 34px; vertical-align:middle"><span style="font-size:30px;">&#8649;</span></button>  
    </div>
    </body>
    </html>