如何在Jumbotron Bootstrap 3中更改字体粗细

时间:2018-05-31 17:55:03

标签: css twitter-bootstrap twitter-bootstrap-3

如何更改.jumbotron.jumbotron和段落的字体粗细? 我不希望我的font-weight如此之大。

HTML:

<header>
    <div class="container-fluid landing-page">
        <div class="jumbotron vertical-center">
            <h1>Embroider<span class="eze">eze</span></h1>
            <p>Branding <span class="eze">&#9679;</span> Promotional Items <span class="eze">&#9679;</span> Reflective Tape <span class="eze">&#9679;</span> Gifts</p>
        </div>
    </div>
</header>

CSS:

.jumbotron {
    color: #dbdbdb;
    background-color: transparent;
    text-align: center;
    margin-top: 300px;
    font-weight: 200;
}

此外,字体大小更改不起作用。

3 个答案:

答案 0 :(得分:1)

默认情况下,bootstrap有一些h1和P的样式。如果你想覆盖try with this

.jumbotron h1{

font-weight: 800;

}

.jumbotron p{

font-weight: 800;

}

答案 1 :(得分:1)

你可以查看:

&#13;
&#13;
<!DOCTYPE html>
<!--[if lt IE 7]>      <html class="no-js lt-ie9 lt-ie8 lt-ie7"> <![endif]-->
<!--[if IE 7]>         <html class="no-js lt-ie9 lt-ie8"> <![endif]-->
<!--[if IE 8]>         <html class="no-js lt-ie9"> <![endif]-->
<!--[if gt IE 8]><!-->
<html class="no-js">
<!--<![endif]-->

<head>
  <meta charset="utf-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <title></title>
  <meta name="description" content="">
  <meta name="viewport" content="width=device-width, initial-scale=1">
  <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css">

  <!-- jQuery library -->
  <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>

  <!-- Latest compiled JavaScript -->
  <script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js"></script>
  <style>
    .jumbotron h1 {
      color: #dbdbdb;
      background-color: transparent;
      text-align: center;
      margin-top: 100px;
      font-weight: 200;
      font-size: 20px;

    }

    .jumbotron p {
      color: #dbdbdb;
      background-color: transparent;
      text-align: center;
      margin-top: 100px;
      font-weight: 200;
      font-size: 20px;

    }
  </style>
</head>

<body>
  <!--[if lt IE 7]>
        <p class="browsehappy">You are using an <strong>outdated</strong> browser. Please <a href="#">upgrade your browser</a> to improve your experience.</p>
      <![endif]-->
  <header>
    <div class="container-fluid landing-page">
      <div class="jumbotron vertical-center">
        <h1>Embroider
          <span>eze</span>
        </h1>
        <p>Branding
          <span>&#9679;</span> Promotional Items
          <span>&#9679;</span> Reflective Tape
          <span>&#9679;</span> Gifts</p>
      </div>
    </div>
  </header>
</body>

</html>
&#13;
&#13;
&#13;

答案 2 :(得分:1)

在BootStrap 4 Jumbotron中调整字体粗细的更新:

类似的语法 - 假设你在css文件中创建一个类,如下所示;

   .jumbotron_text { font-weight: 600; }

并将其应用于jumbotron div中的p标签,如下所示;

    <div class="jumbotron">
      <p class=jumbotron_text">Some text here </p>
    </div>

注意我使用600(范围是100,200,300,400,500,600,700,800,900)。

大多数字体的法线正常为500,粗体为700.

其他数字是浏览器的近似值,除非它特别以字体显示。