字体大小 CSS 问题

3

我正在尝试在CSS中为特定的P标签添加字体大小更改。

我创建了一个新类.mainbg p { xxxx },但这并没有起作用。奇怪的是,当我为该p添加文字阴影时,同样的类起作用了。我不明白为什么它对此不起作用。

我已经添加了CSS类

.mainbg p {
  font-size: bold!important;
}

这也没有任何作用。

<section aria-label="home" class="mainbg" id="home">

<!-- intro -->
<div class="container">
<div class="row">
<div class="overlay-main v-align">
  <div class="col-md-10 col-xs-11">

    <h1 class="onStep" data-animation="animbouncefall" data-time="300">LOUIS WALLACE CONSTRUCTION</h1>
    <div class="onStep" data-animation="fadeInUp" data-time="600" id="slidertext">
      <h3 class="main-text">Oroville General Contractor</h3>
      <h3 class="main-text">Over A Decade Of Experience</h3>
      <h3 class="main-text">All Phases Of Construction</h3>
    </div>
    <p class="onStep" data-animation="animbouncefall" data-time="900" >No matter how large or small the project, we ensure that your project is completed with precision and professionalism. We take pride in our quality craftsmanship, our attention to detail, and our open line of communication with each and every customer. With each project, we understand that our role is about more than simply putting up walls — it’s about ensuring that your vision is turned into a reality.

我能找到的唯一CSS样式是一个动画CSS:
.onStep{ opacity:0; }

当我搜索任何其他CSS onStep时,除了JavaScript之外,什么也没有。困惑。
1个回答

2
你尝试使用了font-size: bold!important;,但这是一个font-weight属性,而不是font-size。这就是为什么它不起作用的原因。 如果你想改变字体的大小,你应该使用一些单位,比如px、em等,例如:
font-size: 40px;

如果你想让文本更加粗体,你也可以使用:

最初的回答

font-weight: bold; 

哇,我简直不敢相信它是那么简单,哈哈。哇,我甚至没有注意到那个。 - Robbie Nichols
对吧?有时候那些小而简单的问题很难被发现,因为我们会忽视它们!很高兴我们找到了错误。如果您能按下勾选标记将问题标记为已解决,我将不胜感激。祝编码愉快! - Adrian Danlos

网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接