
You can get round this by using the user-select:none CSS rule, like so: Īgain, Internet Explorer is the bad guy here, because it doesn't recognise the user-select option - not even Internet Explorer 10 preview supports it, so you have the option of either using JavaScript to prevent background image selection (for example, ) or using CSS 3 background-stretch method.Īlso, for SEO I would put the background image at the bottom of the page, but if the background image takes too long to load (that is, with a white background initially), you could move to the top of the page.
CSS BACKGROUND IMAGE RESIZE BLOCK DISPLAY FULL
Another issue you will find with this method is that when selecting text, the selection area can sometimes encompass the background image, which has the unfortunate effect of making the full page have the selected state. Make sure you set 100% width and height for the body in the CSS and set margins and padding to zero. I agree with the image in absolute div with 100% width and height. You can see the image grow and shrink as you resize your browser. It works well, but I want to place the image using background, not with an img tag. Ive seen some questions on Stack Overflow that do the job, like Stretch and scale CSS background for example. The background image will stretch to fit your browser window. I want that my background image stretch and scale depending on the browser viewport size. This is because we've used CSS to layer the content in front of the background image. with no new line as display:block some how make issue, Share. Is there a way to run an image behind a DIV thats size will change and have the image resize with the size of the DIV thx.

This text appears in front of the background image. I want to run a background image down the DIV and want it to resize depending on the length of the profile.

If you have only one background picture for all pages then you may remove the $pic variable, remove escaping back-slashes, adjust paths and place this code in your CSS file. All the pictures are in the 'image' folder and end with 'Bg.jpg'. Therefore I use PHP to generate its own HTML tag for each page.

The following CSS part should stretch the image with all browsers.
