css - center bk-gnd scroll compensate -


i having trouble centering background behind div. have made fiddle showing how background image stays center whilst browser window resized, great, if scrollbar moved down view bottom of green div, ground follows scroll, no long centered, trying avoid. hope center text of bk-gnd image remain central in view port @ times, whether resizing screen or scrolling, possible?

here interactive fiddle : http://jsfiddle.net/4fm2n/

css

html, body {     height: 100%;     margin: auto; }  #bk-gnd-div {     height: 100%;     background-image: url('http://oi58.tinypic.com/5an82h.jpg');     margin: auto;     background-repeat: no-repeat;     background-position: center center;     background-color: #9fbbe2; } 

the other div code on fiddle, stackoverflow saying not formatted correctly , wont let me post it? maybe clue?

add css

*{ margin: 0; padding: 0;  }  #bk-gnd-div {     margin: 0 auto;     width: 100%; } 

or image fixed center

body {     width: 100%;     height: 100%;     background-image:url('http://oi58.tinypic.com/5an82h.jpg');     margin:0 auto;     background-repeat: no-repeat;     background-position: center center;     background-attachment: fixed; } 

Comments

Popular posts from this blog

user interface - How to replace the Python logo in a Tkinter-based Python GUI app? -

objective c - Greedy NSProgressIndicator Allocation -

how to set an OCR language in Google Drive -