jsBin demo
background: url(image.jpg) fixed 50%;
background-size: cover; /* PS: Use separately here cause of Safari bug */
The fixed
(background-attachment) is optional.
The above is just a shorthand for:
background-image : url(image.jpg);
background-attachment : fixed;
background-position : 50% 50%; /* or: center center */
background-size : cover; /* CSS3 */
You've could in all modern browsers but Safari use:
background: url(image.jpg) fixed 50% / cover;
where the /
is used in background shorthand to separate and distinguish position
from size
(cause position accepts both single and multiple (X,Y) values), but Safari has a bug with this /
shorthand so use as described above.
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…