Dec 2, 2009

Background Fit Any Resolution - hmmm

free web hosting
Open Discussion > MODERATED AREA > Computers > Programming Languages > HTML, XML etc..

Background Fit Any Resolution - hmmm

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.

Comment/Reply (w/o sign-up)

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

Comment/Reply (w/o sign-up)

guangdian
CODE

<body bg="url.img">


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

Comment/Reply (w/o sign-up)

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

Comment/Reply (w/o sign-up)

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.

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

Comment/Reply (w/o sign-up)

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

 

 

 


Comment/Reply (w/o sign-up)

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

Comment/Reply (w/o sign-up)

(G)jananraj
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

Comment/Reply (w/o sign-up)

(G)jananraj
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

Comment/Reply (w/o sign-up)

(G)Brad
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


Comment/Reply (w/o sign-up)



Got an Opinion! Express your Views! (no registration):-
Add your Reply/ Opinion/ Views/ Comments/ Suggestion/ Questions/ Queries etc.
Posts with decent grammar & English will be accepted and please refrain from profanities.
For asking a Question, We recommend you to sign-up (for free) so that you can track the topic easily.

Nature of your Post*: Opinion/ Reply/ Comments
Question/Query
Feedback to us.
       
Name   Email
Title/Question*

This textarea will convert to Rich-Text automatically (IE, Firefox, Chrome)

Similar Topics

Keywords : background, fit, resolution, hmmm

  1. Background Question
    :) (12)
  2. Ok Background Help Please
    html (4)
    OK so i've given up on the paint for background now how would i get it to look like this
    http://img.photobucket.com/albums/v614/Dj1.../background.jpg without using paint and without it
    coming out to look like this... http://img.photobucket.com/albums/v614/Dj169211/Damn.jpg like,
    with just html code, not trying to use paint and do the BS any ideas?....
  3. Help With Background Image
    please? :) (6)
    Ok heres the scoop, i got a background that i made in paint for my website its just like 3 lines for
    the nav bar, banner and other things ect. ect. now when i hosted it on a site and put in the This
    is what it looks like in paint http://img.photobucket.com/albums/v614/Dj1.../background.jpg and
    this is what it looks like when i put it into HTML
    http://img.photobucket.com/albums/v614/Dj169211/Damn.jpg i dont want it tiled like that so is
    there any way that i can change that? any ideas? :| Thanks in advance /smile.gif"
    style="vertical-align:middle" emoid=":)" borde....
  4. Background Image Picture On A Website
    how do u make a pic a backround?? (3)
    ?email me if u know! Trap17 forum asks you to post contributes with substance. ....
  5. Screen Resolution
    I need a code to help out here please... (6)
    Hey everyone.. I was just wondering if there was a code/script that I could insert into my html
    website to change viewers resolution from 1024x800 to 800x600 or something to that effect. It's
    just I use 800x600 at home, and I programme it around that, and it's fine, but on some public
    computers it's default to 1024x800 and can't be changed.. Is there a script to chance
    this??? Help plz anyone!!! Thanks in advance, Sean.....
  6. Centering Page Of Html At Various Display Widths
    Viewing Screen Shots No Matter Resolution (14)
    I am running into a HUGE problem creating a website. When viewing the site on 800x600 it views in
    the center of the page. When viewing the site on 1024x768 it views on the left side of the page. How
    do I make the page always appear in the middle? I have seen many sites set up that will adjust
    accordingly, but I cannot figure it out. If you want to view my source you can do so by going to the
    website: www.faithcity.org/test.html. Moving to the html Topic ....
  7. Usemap And Table Background Image Changing
    (5)
    I have a menu page that consists of links to other pages. The page has a background image of a
    globe. The globe is divided into seperate sections for each menu item. As a user hovers over each
    section I change the background image(The same globe with that section highlighted.) That is what I
    have so far except that they have to hover over a small anchor tag that I put in not the whole
    section. I want to change it so that they can actually hover over all of the section they are
    selecting. I found usemap online but haven't found any examples where it will actually ch....
  8. Fixed Background Image
    Just little reminder (12)
    Easy teahnic, post the following codes between and QUOTE body{background-image: url(
    under.gif ); background-repeat:no-repeat; background-attachment : fixed; background-position:
    10% 20% ;} --> For red colour, change it to your image's location. For green colour, it
    is used to set horizontal and vertical position of background image. I hope it can help you.
    /tongue.gif' border='0' style='vertical-align:middle' alt='tongue.gif' /> ....
  9. Background Resize
    (6)
    Does anyone have the javascript for a background to resize? I want my background to resize to
    1024x768 if the visitor has resolution 1024x768, to 800x600 if the resolution is 800x600 etc.
    Greets, ExplosioN /smile.gif' border='0' style='vertical-align:middle' alt='smile.gif' /> ....
  10. Background Not Big Enough
    (4)
    Hi: Ok, first off....moderaters, please move this topic to the appropriate category. I really
    couldn't find a spot to put this in...so I just picked one. Here is the page I have a question
    about: http://histology-world.com/articles/article9.htm The problem? Scroll down and you can
    see. My background image is not long enough. I have gone into my photo editor and readjusted it,
    just made the canvas size larger. But then I am starting to get concerned about file size. I want
    the lights at the top. When the background image repeats itself, the lights are ins....

    1. Looking for background, fit, resolution, hmmm

Searching Video's for background, fit, resolution, hmmm
See Also,
advertisement


Background Fit Any Resolution - hmmm

Affordable Web Hosting, Low cost Web Hosting - ComputingHost.com