Computer >> บทช่วยสอนคอมพิวเตอร์ >  >> การเขียนโปรแกรม >> CSS

แสดงภาพพื้นหลังเพียงครั้งเดียวด้วย CSS


คุณสมบัติ background-repeat: no-repeat

ใช้ background-repeat: no-repeat เพื่อป้องกันไม่ให้ภาพพื้นหลังทำซ้ำ

ตัวอย่าง

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