background-attachment गुण का उपयोग पृष्ठभूमि में छवि के स्क्रॉलिंग को नियंत्रित करने के लिए किया जाता है।
उदाहरण
निम्न कोड चलाकर background-attachment गुण के साथ काम करना सीखें:
<!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>
</body>
</html>
fixed मान छवि को व्यूपोर्ट के सापेक्ष स्थिर रखता है।