使用 CSS 设置以像素为单位的字体大小

cssweb developmentfront end technology更新于 2024/3/24 10:52:17

要以像素为单位设置字体大小,请使用 px 单位和 font-size 属性。您可以尝试运行以下代码以像素为单位设置字体大小

示例

<!DOCTYPE html>
<html>
   <head>
      <style>
         h1 {
            font-size: 30px;
         }
      </style>
   </head>
   <body>
      <h1>This is demo heading</h1>
      <p>This is demo text.</p>
   </body>
</html>

输出


相关文章


有用资源