Solved

Background images

Posted on 2003-11-10
8
7,504 Views
Last Modified: 2010-04-25
I currently have my site load a background image using this code:

<style type="text/css">
<!--
body
{
  background-position: top;
  background-repeat: no-repeat;
  background-image: url("../Images/Background.jpg");  /*default image background*/
}

-->
</style>

Is it possible to make this image stretch to the full size of users screen rather that it just being the normal pixel size?  
0
Comment
Question by:sre22
8 Comments
 
LVL 1

Accepted Solution

by:
NeoTek earned 25 total points
Comment Utility
Hi,

Unfortunately there is no way to do this with CSS.  Depending on your picture depends on how you can make it look "good".  You can set the background to repeat, use layers or make the image very big.  Could you please provide a link to your site  so I may explain the best possible method?

NeoTek
0
 

Author Comment

by:sre22
Comment Utility
Unfortunately it is an Intranet so you won't have access to it.  The backgrounds fit a 1024x768 resolution but when using a larger resolution the image does not fill the screen.  I tried using a repeating background but it doesn't look right because the image just looks tiled.
0
 

Author Comment

by:sre22
Comment Utility
how do the other options work that you were talking about (frames etc..)
0
 
LVL 8

Assisted Solution

by:klykken
klykken earned 25 total points
Comment Utility
Background images never stretch :-/ That goes for any element unfortunately.

-klykken
0
Threat Intelligence Starter Resources

Integrating threat intelligence can be challenging, and not all companies are ready. These resources can help you build awareness and prepare for defense.

 

Author Comment

by:sre22
Comment Utility
Thanks..
0
 
LVL 2

Expert Comment

by:danalmar
Comment Utility
oups,
sorry to desagree, but you can use a JavaScript to strech it.
thanks to Massimo Foti !


<script language="JavaScript">
function makeIm() {
NS4=(document.layers);
IE4=(document.all);
scaleWidth = true;
scaleHeight = true;
imSRC = "images/yourImage.jpg";
if (NS4) {
origWidth = innerWidth;
origHeight = innerHeight;}
function reDo() {
if (innerWidth != origWidth || innerHeight != origHeight)
location.reload();}
if (NS4) onresize = reDo;
if (IE4) onresize = reDoIE;
function reDoIE(){
imBG.width = document.body.clientWidth;
imBG.height = document.body.clientHeight;}
winWid = (NS4) ? innerWidth : document.body.clientWidth;
winHgt = (NS4) ? innerHeight : document.body.clientHeight;
imStr = "<div id=elBGim"
+ " style='position:absolute;left:0;top:0;z-index:-1'>"
+ "<img name='imBG' border='0' src="+imSRC;
if (scaleWidth) imStr += " width="+winWid;
if (scaleHeight) imStr += " height="+winHgt;
imStr += "></div>";
document.write(imStr);}
makeIm();
</script>
0
 

Expert Comment

by:pmanse
Comment Utility
It's doing exactly what I want/expect it to, but I'm getting an "object required" runtime error on the line: "winWid = (NS4) ? innerWidth : document.body.clientWidth;" I asked a developer who's better with JavaScript than i am if he'd take a look. He's questioning the imBG object and thinks I'm missing an include. Do you know what might be going on?
0
 

Expert Comment

by:pmalatac
Comment Utility
This script doesnt seem to run in navigator 7.1.  It works fin in IE6 though any suggestions??
0

Featured Post

IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

For those who don't know, Adobe Dreamweaver is a popular commercial web editor that enables you to design, build and manage complex websites. The editor is a WYSIWYG (What You See Is What You Get) web editor, which means that you can create your web…
Adobe Dreamweaver CS5 is a WYSIWYG web page editor that has advanced HTML, CSS, and Javascript rendering functionality and is probably the most well-known HTML editor available. Much of Dreamweaver's appeal centers around the Design View interfac…
Get a first impression of how PRTG looks and learn how it works.   This video is a short introduction to PRTG, as an initial overview or as a quick start for new PRTG users.
This tutorial demonstrates a quick way of adding group price to multiple Magento products.

771 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

8 Experts available now in Live!

Get 1:1 Help Now