Home  >  Q&A  >  body text

css - 设置font-family全局字体对网页布局会产生影响?

我在学习慕课网的网页布局基础时碰到这样的问题,相同的html和css代码,设置font-family之前是这样:

在设置了*{font-family:Arial, Helvetica, sans-serif,"宋体";}这条css之后就变成了这样:

刚开始学习 html+css ,很迷惑。

怪我咯怪我咯2715 days ago675

reply all(2)I'll reply

  • 迷茫

    迷茫2017-04-17 14:48:12

    is usually written in a structure like ul>li, and then the li of display is set to inline-block, and it is reversed. However, there is usually at least one line break between li and li, such as:

    <ul>
        <li>A</li>
        <li>B</li>
    </ul>

    This kind has line breaks, unless you write:

    <ul><li>A</li><li>B</li></ul>

    Otherwise, the newline character will cause a gap between li, which is the reason for the newline problem in Figure 1.
    (Master Zhang Xinxu mentioned this in his blog, I suggest you read it~)
    And if a global font is set, one possibility is to make the line breaks "thinner", so the second line will be Pull up.

    reply
    0
  • PHPz

    PHPz2017-04-17 14:48:12

    Guess: Try removing the spaces and line breaks between tags like ul and li in your html.

    reply
    0
  • Cancelreply