কম্পিউটার টিউটোরিয়াল

CSS-এ পটভূমির ছবির স্ক্রোল নিয়ন্ত্রণে কোন property ব্যবহার করা হয়?

পটভূমির ছবির স্ক্রোলিং নিয়ন্ত্রণ করতে background-attachment property ব্যবহার করা হয়। এই property-এর মাধ্যমে ছবিটি পেজের সাথে স্ক্রোল হবে (scroll) নাকি স্থির থাকবে (fixed) তা নির্ধারণ করা যায়।

উদাহরণ

নিচের কোডটি রান করে background-attachment property-র কাজ বুঝতে পারেন:

<!DOCTYPE html> <html>
  <head>
    <style>
      body {
        background-image: url('/css/images/css.jpg');
        background-repeat: no-repeat;
        background-attachment: fixed;
      }
    </style>
  </head>
  <body>
    <p>The background-image is fixed. Try to scroll down the page.</p>
    <p>The background-image is fixed. Try to scroll down the page.</p>
    <p>The background-image is fixed. Try to scroll down the page.</p>
    <p>The background-image is fixed. Try to scroll down the page.</p>
    <p>The background-image is fixed. Try to scroll down the page.</p>
    <p>The background-image is fixed. Try to scroll down the page.</p>
    <p>The background-image is fixed. Try to scroll down the page.</p>
    <p>The background-image is fixed. Try to scroll down the page.</p>
  </body>
</html>

নোট: মূল উদাহরণে একই property দুবার লেখা ছিল (fixed এবং scroll), যা ভুল। শেষের মানই প্রয়োগ হয়। এখানে শুধু fixed রাখা হয়েছে।

  1. অ্যানিমেশনের গতি কার্ভ সেট করার CSS প্রোপার্টি

  2. CSS-এ রেডিয়াল গ্রেডিয়েন্ট ব্যাকগ্রাউন্ড ইমেজ সেট করুন

  3. CSS-এ Background শর্টহ্যান্ড প্রপার্টি

  4. CSS ব্যবহার করে ব্যাকগ্রাউন্ড ইমেজ সেট করা