html - Cover background making background-image unresponsive -


#section{      position: absolute;      top:0;      height: 100%;      width:100%;      background: url("http://cdn9.howtogeek.com/wp-content/uploads/2010/05/ubuntu-human-1440x900.jpg") no-repeat center;      -webkit-background-size: cover;      -moz-background-size: cover;      -o-background-size: cover;      background-size: cover;  }
<body>      <section id="section"></section>  </body>

when background-size set cover image changes size cover window when window size changed. there way cover background totally @ start , when after window size changed make image unresponsive ?

if you're looking make background image fill screen on load, , not resize afterwards (which reconsider - maybe im not seeing big picture, no pun intended ;) )

a possible option load image in seperate div, set z-index:-9999; (which make div sit below other divs), , use javascript determine size of image/div when covers whole page , change size of div javascript element.style.width = ""

window.onload = function(){    thewidth = document.getelementbyid("background").offsetwidth;    theheight = document.getelementbyid("background").offsetheight;    document.getelementbyid("background").style.width = thewidth;    document.getelementbyid("background").style.height = theheight;  }
#background{      position: absolute;      top:0;      height: 100%;      width:100%;      background: url("http://cdn9.howtogeek.com/wp-content/uploads/2010/05/ubuntu-human-1440x900.jpg") no-repeat center;      -webkit-background-size: cover;      -moz-background-size: cover;      -o-background-size: cover;      background-size: cover;  }
<body>      <section id="background"></section>      <section id="your_content"></section>  </body>

if wish make not overflow , give horizontal scrolling after loads, wrap background in <div style = 'max-width:100%; overflow:hidden; position:relative;'> div - overflow:hidden; hide content overflows divs bounds (like div holding image inside of @ original width while current width smaller) , position:relative; needed overflow:hidden; apply (iirc - if remember correctly)


Comments

Popular posts from this blog

java - WARN : org.springframework.web.servlet.PageNotFound - No mapping found for HTTP request with URI [/board/] in DispatcherServlet with name 'appServlet' -

html - Outlook 2010 Anchor (url/address/link) -

javascript - Why does running this loop 9 times take 100x longer than running it 8 times? -