Html 如何仅在一行中增加一个单词的字体大小?

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/4758878/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-29 06:17:18  来源:igfitidea点击:

How to increase the font size of one word only in the line?

htmlcss

提问by Vonder

I have to increase the size of a word in a middle of a normal font-size sentence.

我必须在正常字体大小的句子中间增加一个单词的大小。

<p class="call">To book a consultation click here or call NOW</p>

How can I enlarge the NOW word in CSS? If I create new paragraph the word will go to the new line. Any advice appreciated.

如何在 CSS 中放大 NOW 字样?如果我创建新段落,该词将转到新行。任何建议表示赞赏。

回答by Hogsmill

<p class="call">To book a consultation click here or call <span class='bigger'>NOW</span></p>

with CSS

使用 CSS

.bigger { font-size:200%; }

回答by Quentin

  1. Decide whyyou want it to be bigger (the point is HTML is to describe semantics, not presentation, so you need to think about this sort of thing)
  2. Write appropriate semantic markup
  3. Apply CSS
  1. 决定为什么你想让它更大(重点是 HTML 是描述语义,而不是表现,所以你需要考虑这种事情)
  2. 编写适当的语义标记
  3. 应用 CSS

Perhaps:

也许:

<p class="call">To book a consultation click here or call <em>now</em></p>

and in your stylesheet:

并在您的样式表中:

em {  /* or .call em, but you should aim for consistency in your styling */
    font-style: normal;
    font-size: 120%;
    text-transform: uppercase;
}