पृष्ठभूमि अटैचमेंट सेट करने के लिए, 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>