繁体   English   中英

如何更改 web 页面中的文本大小?

[英]How to change text size in a web page?

我是构建 Web 页面的新手。 只是为了培训,我做了一个非常简单的网站,但是我不明白为什么我不能改变文字大小。

如果我删除背景图像代码有效,但我不能这样做:

<head>
  <link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.5.0/css/bootstrap.min.css">

  <script src="jquery/jquery.min.js"></script>

  <script>
    $(document).ready(function() {
      $("button").click(function() {
        $("h1, p").addClass("dark");
        $("div").addClass("important");
      });
    });
  </script>
  <style>
    body,
    html {
      height: 100%;
    }

    #grad1 {
      background-image: url("https://mdbootstrap.com/img/Photos/Horizontal/Nature/full page/img(20).jpg");
      height: 100%;
      background-position: center;
      background-repeat: no-repeat;
      background-size: cover;

      p {
        font-size: 28px;
      }

      .important {
        font-weight: bold;
        font-size: xx-large;
      }

      .dark {
        color: dark;
      }
  </style>
</head>

<body>

  <div id="grad1">
    <div class="container">
      <h1 align="center">Dzīves jēga</h1><br><br>
      <p align="center"><dfn>“Dzīves jēga nav gaidīt, kad beigsies
          negaiss..
          bet gan iemācīties dejot lietū!”</dfn></p>
      <button type="button" class="btn  btn-lg btn-info">Izmaiņas ir
        neizbēgamas</button>
    </div>
  </div>

</body>

我只是想不通这个选址在这里 2 天。

问题是因为您没有#grad1样式的右括号。

将样式更改为 -

#grad1 {
  background-image: url("https://mdbootstrap.com/img/Photos/Horizontal/Nature/full page/img(20).jpg");
  height: 100%;
  background-position: center;
  background-repeat: no-repeat;
  background-size: cover;
}

这是 JS 小提琴

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM