Loading...


bookmark - Background Fit Any Resolution hmmm

Background Fit Any Resolution - hmmm

 
 Discussion by complexity with 10 Replies.
 Last Update: December 10, 2009, 10:57 pm ( View Rated (1) )
 
bookmark - Background Fit Any Resolution hmmm  
Quickly Post to Background Fit Any Resolution hmmm w/o signup Share Info about Background Fit Any Resolution hmmm using Facebook, Twitter etc. email your friend about Background Fit Any Resolution hmmm Print
Reply / Comment New Discussion / Topic Share / Bookmark E-Mail a Friend Print

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.











   Wed Jun 15, 2005    Reply         

Isn't it just: background: url(yourimage.jpg);

   Wed Jun 15, 2005    Reply         

CODE


<body bg="url.img">


you need it fit any resolution.your backgroud must be so little then it can expand your screen.

   Thu Jun 16, 2005    Reply         


QUOTE (complexity)

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.







   Fri Jun 17, 2005    Reply         

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;
}

   Sun Jun 19, 2005    Reply         

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.

   Thu Jun 23, 2005    Reply         


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...

   Fri Jun 24, 2005    Reply         

how to align in center.Background Fit Any Resolution

hai htmlmaster..,

 I developed my site in 1024*768 screen resolution, when I looked it in 1280*800 screen resolution it doesn't look the same, some tables looks expanded. Thanks a lot I used your code and now it looks as the same but aligned to left the problem is I want to align it to center in higher resolution.

please help..,

-question by jananraj

   Sun Sep 6, 2009    Reply         

how to align in center.Background Fit Any Resolution

hai htmlmaster..,  I developed my site in 1024*768 screen resolution, when I looked it in 1280*800 screen resolution it doesn't look the same, some tables looks expanded. Thanks a lot I used your code and now it looks as the same but aligned to left the problem is I want to align it to center in higher resolution. 

 please help..,

-reply by jananraj

   Sun Sep 6, 2009    Reply         

This Works !!!!!Background Fit Any Resolution

I have struggled with the exact same dilemma, however I have recently figured it out.

Look no further!

Here is the link to the code and CSS:

http://stackoverflow.Com/questions/376253/stretch-and-scale-css-background/388817#388817

-reply by Brad

   Thu Oct 15, 2009    Reply         

Depending upon the amount of traffic your site gets, this could be a very bad idea and could upset your web host. By using GD to generate an image that's displayed every single time a user visits your page, you're putting a lot of unnecessary strain on the server's CPU. Imagine if you have a site that gets even 10,000 total page hits a month - that's 10,000 new graphics your website has to create on the fly.

As a better option, just use a very highly optimized, large background image that looks pleasant even when a portion of the image is cut off for smaller displays. (This is how most sites with large background images handle it.)

Best of luck!

QUOTE (bjrn)

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.

Link: view Post: 152860

   Thu Dec 10, 2009    Reply         

Quickly Post to Background Fit Any Resolution hmmm w/o signup Share Info about Background Fit Any Resolution hmmm using Facebook, Twitter etc. email your friend about Background Fit Any Resolution hmmm Print
Reply / Comment New Discussion / Topic Share / Bookmark E-Mail a Friend Print

Similar Topics:

Desktop Resolution

What desktop resolution are you using? I am using 800x600 80 Hz. ...more

   03-Oct-2007    Reply         

calculate image resolution

calculate image resolutionPhp Resolution Detection?Hi ,I am use this script, but I have one problem when I am upload the image can I calculate the resolution of that image because I have a condition if resolution is less than 72 dpi image is reject to crop else if it is greater than 72 dpi ...more

   22-Jan-2009    Reply         

I Just Installed Smf Image Backgr...

here is the code i have from the start of the body to the first part of the table where i want to create either a background image where i can write some text over it and to the left. the image stretches almost 100% of the screen. here is the code i have so far.... CODE<body>& ...more

   20-Feb-2010    Reply         

Table Width Help table width="100%" goes off screen   Table Width Help table width="100%" goes off screen (2) (7) Html Cool Codes?   Html Cool Codes?