wordpress - CSS 'background-attribute: fixed' but for image -
i want edit wordpress site using theme's css, want make header image fixed when scrolled problem header not background image, picture.
i know if can background image:
.homebg { background-image: url('someimage.jpg'); background-attribute: fixed; }
but command use if case:
.homebg { content: url('someimage.jpg'); /*make image stay when scrolled*/ }
note: changing "content" "background-image" not work theme using.
you try position:fixed;
change:
.homebg { content: url('someimage.jpg'); }
to:
.homebg { content: url('someimage.jpg'); position:fixed; top:0px; left:0px; }
it's important note when using top:0px;
left:0px;
or alternatively right:0px;
position elements via position:fixed;
position fixed relative entire browser window. may need adjust z-index
of .homebg
if becomes fixed on top of other elements.
more information on position
http://css-tricks.com/absolute-relative-fixed-positioining-how-do-they-differ/
Comments
Post a Comment