【问题标题】:Two different font-family in one sentence?一句话里有两种不同的字体系列?
【发布时间】:2021-02-20 11:57:34
【问题描述】:

如何在一个句子中使用两种不同的字体系列?

例如这样:

卖家:苹果、梨、黄瓜

我尝试过以下操作:

<p><span>Seller:</span> </p> <h5> apple, pear, cucumber</h5> 

.p {
  //text-align: left;
  font-size: 17px;
  font-weight: 300;
  font-family: 'PoppinsLight', sans-serif;
  color: #000;
  z-index: 1;
  transition: 0.5s; 
   
}
 
.h5{
   margin-bottom: 10px;
   margin-top: 5px;
   font-family: 'PoppinsMedium';
   font-style: normal;
   font-size: 17px;
}

但它不起作用。它会导致一个新段落

【问题讨论】:

  • 你的意思是“它导致一个新的段落”是的。这绝对是因为您在 p 标记中使用了 h5 标记。 h5 标记使换行符。
  • 首先你需要改代码如下,这样你的新线路问题就不会导致

    Seller:苹果、梨、黄瓜

标签: fonts font-family


【解决方案1】:

由于覆盖样式,可能会发生此问题。无论如何,您可以尝试以下代码,

.p {
  //text-align: left;
  font-size: 17px;
  font-weight: 300;
  font-family: 'PoppinsLight', sans-serif !important;
  color: #000;
  z-index: 1;
  transition: 0.5s; 
   
}
.h5{
   margin-bottom: 10px;
   margin-top: 5px;
   font-family: 'PoppinsMedium' !important;
   font-style: normal;
   font-size: 17px;
}

这里!important优先考虑这种风格。

【讨论】:

  • 这个答案是关于如何在某些样式被另一种样式覆盖时给予某些优先级。
猜你喜欢
  • 1970-01-01
  • 2020-10-30
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2012-04-26
  • 1970-01-01
  • 2020-11-10
  • 2011-11-16
相关资源
最近更新 更多