It appears you have not yet registered with DEVPPL. To register please click here... (it's fast, easy and free!)

Forum

Log In Sponsors
Board index Programming HTML Forum

Background image always fitting?

Background image always fitting?

Postby MM xSkillz on Mon Nov 10, 2008 7:55 pm

Hello,

How do I create a background image that always fits across the screen no matter what the screen resolution is? I found a site that I think does just that but I cannot figure out how:

http://perishablepress.com/

I'm on a school computer so I can't mess around with the screen resolution to see if it stretches to fit any screen size but I have the feeling it probably does. So, is there any way to accomplish this and make a background image always fit across the screen no matter what the resolution? Thanks in advance!
MM xSkillz
100+ Club
 
Posts: 196
Joined: Fri Mar 16, 2007 5:07 pm

Postby dflynn on Mon Nov 10, 2008 9:06 pm

you need to creat a repeating image. basically just a pattern. You centre the image in the background and repeat-x
and thats about it.
And then you just lock the scrolling on it. i can't remember the tag off the top of my head. fixed i think. and it won't scroll.
User avatar
dflynn
500+ Club
 
Posts: 860
Joined: Wed Oct 03, 2007 9:06 pm
Location: Guelph, Canada

Postby MM xSkillz on Mon Nov 10, 2008 11:58 pm

Are you sure there's no way to just have an image stretch to fit the background then keep the same proportions so it doesn't look all weird? I noticed this post:

screen-resolution-checker-v-simple-vt9511.html

On screen resolution. I don't understand JavaScript or any of that but is there a way you could just find the person's screen resolution then pass it to PHP and add an include script that determines the width of the background image?
MM xSkillz
100+ Club
 
Posts: 196
Joined: Fri Mar 16, 2007 5:07 pm

Postby dflynn on Tue Nov 11, 2008 12:16 am

you could probably do it but then you'd have to have an image that could fit any size screen which means heaftier file size.

the site you linked to on the first post only did what I described to you in my response.
User avatar
dflynn
500+ Club
 
Posts: 860
Joined: Wed Oct 03, 2007 9:06 pm
Location: Guelph, Canada

Postby flabbyrabbit on Tue Nov 11, 2008 11:37 am

The website used a big image as the background...and then they used this code:
Code: Select all
background: #000000 url(../images/background.jpg) repeat-x fixed center top;
So the image is fixed and doesn't scroll with the page and its also held in place by the top middle of the screen so when you resize it still has the pattern in the right place.

Flabby Rabbit
Image
User avatar
flabbyrabbit
500+ Club
 
Posts: 706
Joined: Thu Jan 25, 2007 1:10 pm
Location: Midlands, England

Postby MM xSkillz on Thu Nov 13, 2008 7:11 pm

But what if I want to use an photograph (or screenshot in my case since it's a Halo 3 website) as a background? Is that just not very practical since it isn't really supported by HTML or CSS?
MM xSkillz
100+ Club
 
Posts: 196
Joined: Fri Mar 16, 2007 5:07 pm

Postby flabbyrabbit on Thu Nov 13, 2008 10:37 pm

So you want it to constantly fill the whole screen? It is possible but it would distort if you resized the browser so it was to wide etc.. So its not really the best idea.

Flabby Rabbit
Image
User avatar
flabbyrabbit
500+ Club
 
Posts: 706
Joined: Thu Jan 25, 2007 1:10 pm
Location: Midlands, England


Who is online

Users browsing this forum: No registered users and 8 guests