html 文本边缘从div溢出,显示:直列式

vu8f3i0k  于 2022-12-16  发布在  其他
关注(0)|答案(1)|浏览(89)

我怎样才能防止这种情况?“f”字符的边缘从div溢出。我怎样才能使它适合文本?HTML代码:

<!DOCTYPE html>
<html lang="en">

<head>
  <meta charset="UTF-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Document</title>
</head>

<body>
  <div class="parent" style="display: inline;  background-color: coral; font-size: 200px;">test f</div>
</body>

</html>

9rbhqvlz

9rbhqvlz1#

您也可以尝试向左和向右填充。

<!DOCTYPE html>
<html lang="en">

<head>
  <meta charset="UTF-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Document</title>
</head>

<body>
  <div class="parent" style="display: inline; padding:0 25px; background-color: coral; font-size: 200px;">test f</div>
</body>

</html>

相关问题