Font underside in span

write the end text in a span and find that the font is offset downward relative to the space where the span is located. I only use the line-height setting to center the span relative to the parent, but the font inside is still offset downward relative to the span.
but this won"t happen if I rewrite a demo. Please give me your advice.

clipboard.png

clipboard.png

    .header-nav{
      float: left;
      width: 200px;
      height: 40px;
      background-color: lightgrey;
      span{
        line-height: 40px;
        font-size: 20px;
        background-color: red;
      }
    }
Mar.21,2021

text alignment defaults to baseline alignment, that is, the bottom edge of the letter x. You can take a look at this blog
link


alphanumeric alignment is baseline alignment, Chinese characters are bottom line alignment, four lines =" bottom line, baseline, middle line, top line, which is somewhat similar to four lines and three grids. You can compare English 'good'' with Chinese 'good'.


I just gave the fish
textAlign: middle;


to change the line-height (line spacing) to the same height as div

MySQL Query : SELECT * FROM `codeshelper`.`v9_news` WHERE status=99 AND catid='6' ORDER BY rand() LIMIT 5
MySQL Error : Disk full (/tmp/#sql-temptable-64f5-1b35fb8-4101a.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
MySQL Errno : 1021
Message : Disk full (/tmp/#sql-temptable-64f5-1b35fb8-4101a.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?