Welcome Guest ( Log In | Register)



 
Reply to this topicStart new topic
> Background Fit Any Resolution, hmmm
complexity
post Jun 16 2005, 05:07 AM
Post #1


Newbie [Level 1]
Group Icon

Group: Banned
Posts: 14
Joined: 16-June 05
Member No.: 8,283



Is it possible to do with html. I have found a few solutions but they dont seem to work. I know it is possible in java. But anyone have the code for html? Would really appreciate it.
Go to the top of the page
 
+Quote Post
rvovk
post Jun 16 2005, 06:23 AM
Post #2


Super Member
*********

Group: Members
Posts: 378
Joined: 13-October 04
From: Slovenia
Member No.: 1,731



Isn't it just: background: url(yourimage.jpg);
Go to the top of the page
 
+Quote Post
guangdian
post Jun 16 2005, 08:12 AM
Post #3


Trap Grand Marshal Member
***********

Group: Members
Posts: 1,183
Joined: 24-September 04
Member No.: 1,245



CODE

<body bg="url.img">


you need it fit any resolution.your backgroud must be so little then it can expand your screen.
Go to the top of the page
 
+Quote Post
sxyloverboy
post Jun 17 2005, 02:17 PM
Post #4


Super Member
*********

Group: Members
Posts: 302
Joined: 17-June 05
From: Frankfurt, Germany
Member No.: 8,358



QUOTE(complexity @ Jun 16 2005, 06:07 AM)
Is it possible to do with html. I have found a few solutions but they dont seem to work. I know it is possible in java. But anyone have the code for html? Would really appreciate it.
*




I dont think its actualy possible with just html but i know that you can do it with javascript. i found it on a site once where you just needed to change the url to the image in this code. Its a code that would resize according to the size of the window. but plain html? dont think so.
Go to the top of the page
 
+Quote Post
bjrn
post Jun 19 2005, 01:00 PM
Post #5


Super Member
*********

Group: Members
Posts: 378
Joined: 8-January 05
Member No.: 3,174



Background images are just like normal images in HTML documents, you can't set them to resize to whatever the user has.

You could use some PHP GD functions with some browser sniffing to resize the image before sending it to the client. What you'd have to do is this:
  • When the user comes to your page, check what resolution they are using.
  • Have a PHP function that resizes your background image to the resolution
  • Set the generated image as background image
  • Send all data to the user.

I am assuming you have some high-resolution image that scales down very well, because most resizing doesn't work very well when there are big changes. I am also assuming your background image doesn't work when you put the image side-to-side, repeating both left-to-right and up-to-down, if that works all you have to do is add
CODE
body {
background-image: url(your-background.image);
background-repeat: repeat;
}
Go to the top of the page
 
+Quote Post
htmlmaster
post Jun 23 2005, 01:55 PM
Post #6


Newbie [Level 2]
**

Group: Members
Posts: 27
Joined: 23-June 05
Member No.: 8,585



No, its not possible, however you are right, it does work in JavaScript, if you require the script then:
CODE

var jswidth = screen.width;
if (jswidth==800) document.write("<div class='main' style='width:63%;'>");
else if (jswidth==1024) document.write("<div class='main' style='width:72%;'>");
else if (jswidth==1152) document.write("<div class='main' style='width:75%;'>");
else if (jswidth==1280) document.write("<div class='main' style='width:77%;'>");
else document.write("<div class='main' style='width:63%;'>");

Name that file homepage.js for your convienience. Link to this file by using
CODE

<script type="text/javascript"src="/index/homepage.js"></script>

right before your main content in the homepage. Then make this file:
CODE

document.write("</div>");

Name it divclose.js. Place the following code after your content:
CODE

<script type="text/javascript"src="/index/divclose.js"></script>

This is untested, but I am almost positive it would work.
Go to the top of the page
 
+Quote Post
bjrn
post Jun 24 2005, 12:07 PM
Post #7


Super Member
*********

Group: Members
Posts: 378
Joined: 8-January 05
Member No.: 3,174



Uhm, what good would that script be? It makes a div which is somewhat smaller than the screen it is viewed in. And depending on the contents of the div you might get a clipped or crunched image inside it...
Go to the top of the page
 
+Quote Post

Reply to this topicStart new topic

Collapse

> Similar Topics

Topics Topics
  1. Fixed Background Image(10)
  2. Usemap And Table Background Image Changing(5)
  3. Centering Page Of Html At Various Display Widths(14)
  4. Screen Resolution(6)
  5. Background Image Picture On A Website(3)
  6. Help With Background Image(6)
  7. Ok Background Help Please(4)
  8. Background Question(12)


 



- Lo-Fi Version Time is now: 29th August 2008 - 03:45 AM