如何让Glyphicons更大?(改变尺寸?)

Cod*_*yan 230 html css twitter-bootstrap glyphicons

我想让全球字形更大,以便覆盖页面的大部分(它是矢量图像).它不是按钮或任何东西; 它只是一个人.有没有办法做到这一点?

<div class = "jumbotron">
    <span class="glyphicon glyphicon-globe"></span>
</div>  
Run Code Online (Sandbox Code Playgroud)

Ven*_*dor 351

增加字体大小glyphicon以增加所有图标大小.

.glyphicon {
    font-size: 50px;
}
Run Code Online (Sandbox Code Playgroud)

要仅定位一个图标,

.glyphicon.glyphicon-globe {
    font-size: 75px;
}
Run Code Online (Sandbox Code Playgroud)

  • 使glyphicon更大"按需"使用.glyphicon.larger {font-size:150%; } (7认同)
  • 那很有效!(我会在5分钟内接受它(剩下的时间))有没有办法让它居中?@VenomVendor (2认同)
  • div上的`text-center`. (2认同)

Mr.*_*ley 139

Fontawesome有一个完美的解决方案.

我实现了同样的.只需在您的主.css文件中添加此项

.gi-2x{font-size: 2em;}
.gi-3x{font-size: 3em;}
.gi-4x{font-size: 4em;}
.gi-5x{font-size: 5em;}
Run Code Online (Sandbox Code Playgroud)

在你的例子中,你只需要这样做.

<div class = "jumbotron">
    <span class="glyphicon glyphicon-globe gi-5x"></span>
</div>  
Run Code Online (Sandbox Code Playgroud)


Ali*_*avi 67

如果你使用bootstrap和font-awesome那么它很容易,不需要编写一行新代码,只需添加fa-Nx,就像你想要的那样大,看看演示

<span class="glyphicon glyphicon-globe"></span>
<span class="glyphicon glyphicon-globe fa-lg"></span>
<span class="glyphicon glyphicon-globe fa-2x"></span>
<span class="glyphicon glyphicon-globe fa-3x"></span>
<span class="glyphicon glyphicon-globe fa-4x"></span>
<span class="glyphicon glyphicon-globe fa-5x"></span>
Run Code Online (Sandbox Code Playgroud)


Ter*_*lem 17

是的,基本上你也可以使用内联样式:

<span style="font-size: 15px" class="glyphicon glyphicon-cog"></span>
Run Code Online (Sandbox Code Playgroud)


Bag*_*ono 11

尝试使用标题,不需要额外的CSS

<h1 class="glyphicon glyphicon-plus"></h1>
Run Code Online (Sandbox Code Playgroud)

  • 使用标题因为它们对字体大小的影响是一种反模式.通过键盘导航您的网站的用户将直接发送到您的图标,因为屏幕阅读器假定它表示页面上最重要内容的标题/标题. (6认同)
  • 你可以做到这一点,但它不会像一点CSS一样给你一个很好的控制水平. (2认同)

Ope*_*War 9

对于ex ..添加类:

btn-lg - LARGE

btn-sm - 小

btn-xs - 非常小

<button type=button class="btn btn-default btn-lg">
<span class="glyphicon glyphicon-star" aria-hidden=true></span> Star
</button> 

<button type=button class="btn btn-default">
<span class="glyphicon glyphicon-star" aria-hidden=true></span>Star
</button>

 <button type=button class="btn btn-default btn-sm">
<span class="glyphicon glyphicon-star" aria-hidden=true></span> Star
</button> 

<button type=button class="btn btn-default btn-xs">
<span class="glyphicon glyphicon-star" aria-hidden=true></span> Star
</button> 
Run Code Online (Sandbox Code Playgroud)

参考链接Bootstrap:Glyphicons Bootstrap

  • 问题是图像,而不是图像作为按钮. (7认同)