Html 如何在引导程序中增加字体大小

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/45718623/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-29 14:51:05  来源:igfitidea点击:

How to increase font size in bootstrap

htmlcsstwitter-bootstrap

提问by Lion

I need to increase following telephone number font size.

我需要增加以下电话号码字体大小。

<div class="topbar">
    <div class="container">
        <div class="row">
            <div class="col-md-12">
                <p class="pull-left hidden-xs"><i class="fa fa-clock-o"></i><span>Mon - Sat 8.30AM - 5.00PM. Sunday CLOSED</span></p>
                <p class="pull-right"><i class="fa fa-phone"></i>Tel No. (+77) 853 740 966</p>
            </div>
        </div>
    </div>
</div>

回答by fen1x

Wrap it in span and add css to it:

将其包裹在 span 中并向其添加 css:

.text-large {
  font-size: 150%;
}
<div class="topbar">
  <div class="container">
    <div class="row">
      <div class="col-md-12">
        <p class="pull-left hidden-xs"><i class="fa fa-clock-o"></i><span>Mon - Sat 8.30AM - 5.00PM. Sunday CLOSED</span></p>
        <p class="pull-right text-large"><i class="fa fa-phone"></i><span>Tel No. (+77) 853 740 966</span></p>
      </div>
    </div>
  </div>
</div>

回答by Chloe

Update: <big>is supposed to be deprecated in HTML5, so CSS is the only way. Using a relative size works best no matter what the current font size is.

更新:<big>应该在 HTML5 中被弃用,所以 CSS 是唯一的方法。无论当前字体大小如何,使用相对大小效果最好。

.font-size-lg { font-size: 1.2rem; }


I haven't found an easy way with Bootstrap, so I use <big>.

我还没有找到使用 Bootstrap 的简单方法,所以我使用<big>.

<p class="pull-right">
  <big><i class="fa fa-phone"></i>Tel No. (+77) 853 740 966</big>
</p>

I wish there was a Bootstrap class so I don't have to use an extra line in HAML.

我希望有一个 Bootstrap 类,所以我不必在 HAML 中使用额外的行。

%p
  %big This is bigger.

回答by Rad

<span style="font-size:30px">Tel No. (+77) 853 740 966</span>

Or

或者

.large-fontsize{
font-size: 30px !important;
}  

<span class="large-fontsize">Tel No. (+77) 853 740 966</span>

回答by Olof

If you are using SCSS of similar to generate your CSS, you can add your own global class that slightly increases (+25%) the font size.

如果您使用的是类似的 SCSS 来生成您的 CSS,您可以添加您自己的全局类,稍微增加 (+25%) 字体大小。

In the _variables.scss found in the Bootstrap bundle there is a variable already defined $font-size-lg. Use it to define a class in your own style.scss (or similar) in your project.

在 Bootstrap 包中的 _variables.scss 中,已经定义了一个变量 $font-size-lg。在您的项目中使用它在您自己的 style.scss(或类似)中定义一个类。

.font-size-lg {
  font-size: $font-size-lg;
}

Use it in HTML

在 HTML 中使用它

<span class="font-size-lg">Text to enlarge</span>

回答by gspotprod

You can always bypass bootstrap and edit the font size at the source in-line:

您始终可以绕过引导程序并在线编辑源代码中的字体大小:

style="font-size:x-large;"