Make background image fixed in Safari for iPad
October 22 - 2026The css background-attachment: fixed; does not work in iPad Safari.
This code take care of that.
<!DOCTYPE HTML>
<html>
<head>
<title>Safari fixed background</title>
<style>
body {
font-family: Arial, Helvetica, sans-serif;
font-size: 18px;
}
.content {
position: relative;
z-index: 1;
}
.fixed-background {
position: fixed;
left: 0;
bottom: 0;
width: 100vw;
height: 100vh;
z-index: -1;
background-image: url('background.jpg');
background-repeat: repeat;
}
</style>
</head>
<body>
<div class="fixed-background"></div>
<div class="content">
Your page content goes here
</div>
</body>
</html>
Download example code