html - 使用谷歌网络字体 Bootstrap

标签 html css twitter-bootstrap fonts

我希望下面示例中的 h1 文本在 body 中使用两种不同的 Google Web 字体:

<div class="container text-center">
    <h1 class="display-1 mt-5">This Is My Title</h1>
    <p class="lead mb-5">Coming Soon!</p>
</div>

我在 header 中创建了以下内联代码:

<!-- Google Web Fonts -->
<link href="https://fonts.googleapis.com/css?family=Play|Sacramento" rel="stylesheet">

<!-- Inline Style -->
<style>
    .logo-1:{
    font-family: 'Play', sans-serif;
        }
    .logo-2:{
    font-family: 'Sacramento', cursive;
    }
</style>

我将如何在 Play 字体中制作“This Is”和在 Sacramento 字体中制作“My Title”?

最佳答案

使用 span 元素,它允许您在不影响布局和定位的情况下添加样式,因为 span 是一个内联元素。

<h1 class="display-1 mt-5">
  <span class="logo-1">This Is </span>
  <span class="logo-2">My Title</span>
</h1>

关于html - 使用谷歌网络字体 Bootstrap ,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/41991362/

相关文章:

css - Bootstrap padding BG 颜色

html - 将列设置为页面的全高,不超过页面大小

html - 如何防止在 IE 中选择文本?

jquery - 输入标签应该适契约(Contract)一行而不是第二行CSS问题

html - CSS 类已更改,但样式需要时间才能应用

css - 使用负边距时内容被隐藏

html - 如何使用 Bootstrap 在 Twig 中对齐按钮和输入

html - 使内联 block 在顶部而不是底部对齐

jquery - 如何从 iframe 获取 href 链接

html - 将 "Widgets"样式设置为内联并在较小的屏幕下彼此下方