Creating a Fixed Background for a Website

Fixed Background Image

background:url('http://yoururl');    
background-size: cover;
background-attachment: fixed;

How to make fixed full page background image on mobile as well as desktop? Wordpress - Divi - CSS

this css need to change:

body.custom-background {
...
background-attachment: fixed;
}

Fixed Background Image for Mobile with CSS

background-attachment: fixed; does not work on mobile webkit. There is a workaround, you can place the image inline in the html, set the position fixed and z-index below the content.

this is related Using background-attachment:fixed in safari on the ipad

How to force a background image to have a fixed width in pixels

body {  background-image: url("https://images.unsplash.com/photo-1477915737647-b5246ee6de6f?dpr=1&auto=format&fit=crop&w=1500&h=1000&q=80&cs=tinysrgb&crop=");  background-size: 500px auto;  background-repeat: no-repeat;  background-attachment: fixed;  background-position: center;  }
<!DOCType html><html>  <body>  </body></html>


Related Topics



Leave a reply



Submit