Solved

Background images

Posted on 2003-11-10
8
7,511 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
8 Comments
 
LVL 1

Accepted Solution

by:
NeoTek earned 25 total points
ID: 9718057
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
ID: 9718259
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
ID: 9718287
how do the other options work that you were talking about (frames etc..)
0
Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

 
LVL 8

Assisted Solution

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

-klykken
0
 

Author Comment

by:sre22
ID: 9723367
Thanks..
0
 
LVL 2

Expert Comment

by:danalmar
ID: 10019565
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
ID: 10736476
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
ID: 11555442
This script doesnt seem to run in navigator 7.1.  It works fin in IE6 though any suggestions??
0

Featured Post

[Webinar] Code, Load, and Grow

Managing multiple websites, servers, applications, and security on a daily basis? Join us for a webinar on May 25th to learn how to simplify administration and management of virtual hosts for IT admins, create a secure environment, and deploy code more effectively and frequently.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

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…
With Secure Portal Encryption, the recipient is sent a link to their email address directing them to the email laundry delivery page. From there, the recipient will be required to enter a user name and password to enter the page. Once the recipient …
In a recent question (https://www.experts-exchange.com/questions/29004105/Run-AutoHotkey-script-directly-from-Notepad.html) here at Experts Exchange, a member asked how to run an AutoHotkey script (.AHK) directly from Notepad++ (aka NPP). This video…

734 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