Go Back   CodingForums.com > :: Client side development > HTML & CSS

Before you post, read our: Rules & Posting Guidelines

Reply
 
Thread Tools Rate Thread
Enjoy an ad free experience by logging in. Not a member yet? Register.
Old 04-02-2009, 08:50 PM   PM User | #1
petalmax
New Coder

 
Join Date: Mar 2009
Posts: 27
Thanks: 3
Thanked 0 Times in 0 Posts
petalmax is an unknown quantity at this point
background image size

Using HTML, how can I specify a background image to fit any size monitor/screen, without it tiling? I can use an image editor, photoshop, to resize it. If so, how big should I make it? Or, can I make it stretch somehow using HTML code to fit anybodies screen?
petalmax is offline   Reply With Quote
Old 04-03-2009, 02:14 AM   PM User | #2
Excavator
Master Coder


 
Excavator's Avatar
 
Join Date: Dec 2006
Location: Alaska
Posts: 9,410
Thanks: 22
Thanked 1,765 Times in 1,749 Posts
Excavator has a spectacular aura aboutExcavator has a spectacular aura aboutExcavator has a spectacular aura about
Hello petalmax,
Have a look at this demo - http://nopeople.com/CSS/background_i...ize/index.html

As long as you're aware that the end user can size his browser so your background image is very skewed out of proportion... if your ok with that, it works.

View the source to see how it works.
__________________
Validate often DURING development - Use it like a splelchecker | Debug during Development |Write it for FireFox, ignore IE
Use the right DocType | Validate your markup | Validate your CSS | Why validating is good | Why tables are bad
Excavator is offline   Reply With Quote
Old 04-06-2009, 01:03 PM   PM User | #3
petalmax
New Coder

 
Join Date: Mar 2009
Posts: 27
Thanks: 3
Thanked 0 Times in 0 Posts
petalmax is an unknown quantity at this point
Quote:
Originally Posted by Excavator View Post
Hello petalmax,
Have a look at this demo - http://nopeople.com/CSS/background_i...ize/index.html

As long as you're aware that the end user can size his browser so your background image is very skewed out of proportion... if your ok with that, it works.

View the source to see how it works.
Hi Excavator, I enjoyed the code for the very large sized background image and will reference it perhaps in other circumstances however for this, the image cannot be skewed.
Looking at it I realize the height can remain and eventually be accessed with a scroll bar when more information is added to the web page. It is the width that I'd like to fit any size monitor screen. After more time with this, unfortunately, I'm still stumped. I've noticed with a body background color set at 100% for width and height, this is not an issue. Thank you and please pass along anymore thoughts here.
petalmax is offline   Reply With Quote
Old 04-06-2009, 01:38 PM   PM User | #4
Scriptet
Regular Coder

 
Join Date: Apr 2008
Posts: 685
Thanks: 15
Thanked 105 Times in 104 Posts
Scriptet is on a distinguished road
You cannot currently size a background image at a percentage, say 100% so that it would fit any browser width.
However I believe this is implemented in CSS3, but forget about that for now because it's ages away, plus it would cause problems with image re-sizing.

Your options are to have the background image, as a simple image e.g <img src="blah.jpg" /> and set that to 100% width and position it in a way to act as a background, but this implements extra markup and is not very good design.

Another option is to create the image so that it fades out towards the left and right into a common colour, and make it the size for the biggest resolution. That way small monitors get a nice background and large monitors also. The fading isn't needed but may help.

Check this site for example: http://www.webdesignerwall.com/
Their background image is huge, but on a small 1024x768 monitor you still get a nice looking background that doesn't seem chopped, whilst even bigger monitors are getting even more.
Scriptet is offline   Reply With Quote
Old 04-06-2009, 02:38 PM   PM User | #5
petalmax
New Coder

 
Join Date: Mar 2009
Posts: 27
Thanks: 3
Thanked 0 Times in 0 Posts
petalmax is an unknown quantity at this point
Quote:
Originally Posted by Scriptet View Post
You cannot currently size a background image at a percentage, say 100% so that it would fit any browser width.
However I believe this is implemented in CSS3, but forget about that for now because it's ages away, plus it would cause problems with image re-sizing.

Your options are to have the background image, as a simple image e.g <img src="blah.jpg" /> and set that to 100% width and position it in a way to act as a background, but this implements extra markup and is not very good design.

Another option is to create the image so that it fades out towards the left and right into a common colour, and make it the size for the biggest resolution. That way small monitors get a nice background and large monitors also. The fading isn't needed but may help.

Check this site for example: http://www.webdesignerwall.com/
Their background image is huge, but on a small 1024x768 monitor you still get a nice looking background that doesn't seem chopped, whilst even bigger monitors are getting even more.
Hi Scriptet, I like your suggestions and I love the website from the link you provided. I looked all over it to isolate the background image, but with no luck so far. If you know the steps of how this was done could you direct me further? It looks like javascript and css. Perhaps it's this piece of code, http://www.webdesignerwall.com/wp-co...x/thickbox.css, but still can't isolate the background image. Thanks for all the input.
petalmax is offline   Reply With Quote
Reply

Bookmarks

Tags
background image, css, html, photoshop, size

Jump To Top of Thread


Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 08:58 AM.


Advertisement
Log in to turn off these ads.