使用 CSS 实现背景图片仅显示一次

cssweb developmentfront end technology更新于 2025/5/10 7:40:17

使用 background-repeat属性可实现背景图片仅显示一次。您可以尝试运行以下代码来实现background-repeat属性 −

示例

<!DOCTYPE html>
<html>
   <head>
      <style>
         body {
            background-image: url("https://www.cainiaomax.com/videotutorials/images/tutor_connect_home.jpg");
            background-repeat: no-repeat;
         }
      </style>
   </head>
   <body>
      <h1>Background Image</h1>
   </body>
</html>

相关文章


有用资源