Web Design Forum  
 
Go Back   Web Design Forum > Web and Graphic Design > Web Design

Reply
 
LinkBack Thread Tools Display Modes
Old 01-10-2011, 02:01 PM   #1
Bronze Member
 
Join Date: Oct 2009
Posts: 45
Default What to use for background image and how to use transparency with a background image

I am wondering what the best way to make a background is? I would like to use an image. However, that are many problems that I have encountered. For example, if I make the image too small and someone uses a higher resolution that me, the image will not cover the whole page. Furthermore, if I make the image too large, as I currently have my background, it is taking too long to load ( Probably 5 to 8 seconds on a decent connection ). I made the image 3000 pixels wide so that no matter what resolution someone was using, unless they used a crazy resolution, the image would cover their whole screen. However, as stated, that image takes too long to load.

Other solutions I have found are to make the 4 to 8 pixel wide image that basically look like a long line. Then, let this repeat. These have loaded quickly in the past. However, that does not let me use an image.

So, I would like to use an image if possible. How can I accomplish this and have it load quickly? If not, is the best way to do as I said as an alternative by creating the few pixel wide image and letting it repeat.


Furthermore, I would like to make my image transparent. I have not found a way to create a transparent background easily yet. Any ideas?
toolmania1 is offline   Reply With Quote


Old 01-10-2011, 02:50 PM   #2
Gold Member
 
smoovo's Avatar
 
Join Date: Oct 2010
Posts: 388
Default

You can use image as a background (you already know that...), and you can set it up with JavaScript (you can use PHP too) to fit any screen. What i'm saying is that you can do it in the smart way of letting the user choose it's own size.

You need to make 3 different sizes of the same image. While user will enter your site it will recognize the window size and will upload the image that will fit he's/her's screen. Also, use width 100% (only width), since all the screens are more wider than higher this will fit all the screen, and make it "background-position: center center;"

Transparent background can be used with .PNG image that edited to be transparent, or, to use CSS3 with "background-color: rgba(255,255,255,0.5);",
the a stand for "Alpha" (0, 0.1, ..., 1).

- Good Luck.
__________________
SMooVo - Web Design & Development
contact@smoovo.com
www.SMooVo.com
smoovo is offline   Reply With Quote
Old 01-10-2011, 05:55 PM   #3
Super Moderator
 
Join Date: Oct 2008
Location: Arizona, USA
Posts: 1,053
Default

What are you adding the background image to? the body? a div? As of now, I don't see why you are having issues making it repeat, nor do I see why you would need javascript.

If you can, please provide an example of what you are attempting to do, this will help us better guide you to the right solution.

Like smoovo mentioned, you can use css3 to accomplish this, but for consistency purposes, you would still need a fallback for all browsers that don't support it.
__________________
John Darling
Graphic / Web Designer
SmarterTools Inc.
(877) 357-6278
www.smartertools.com
PixelPusher is offline   Reply With Quote
Old 01-11-2011, 12:09 PM   #4
Bronze Member
 
Join Date: Oct 2009
Posts: 45
Default Using Background image for the body

I believe as of right now that I am going to use the background image for the body tag. I am not against a better way though. I do not know which ways are better. So, I guess we actually could start there. What do you think? Is it better to put the background image, that will fill up the whole page on any screen resolution, on the body tag or should I make a div tag and put in on that? If I put the background image on the div tag, how do I make it so that no matter what the screen resolution, the background image will be centered.

Also, when using php, would I do something like this:

if screen.resolution < 1024
{
use image 1
}
elseif screen.resolution > 1024 && < 1600
{
use image 2
}
else
{
use image 3
}

?

I know the syntax is not correct. I was just posting pseudocode. I can google the syntax unless you quickly know what it would be.

Thanks in advance!
toolmania1 is offline   Reply With Quote
Old 01-12-2011, 01:57 AM   #5
Super Moderator
 
Join Date: Oct 2008
Location: Arizona, USA
Posts: 1,053
Default

I think you are over complicating matters. You should not need to check the screen resolution at all. If you set a background image for the body tag, the body will expand to the full width and height of the browser window.

Here is an example:
(image is a gradient flows from color stop #333 to color stop #999, linear, top to bottom. Dimensions 2x768)

Code:
body {
   background:#999 url(../images/gradient-bg.png) left top repeat-x;
}
__________________
John Darling
Graphic / Web Designer
SmarterTools Inc.
(877) 357-6278
www.smartertools.com
PixelPusher is offline   Reply With Quote


Reply

Tags
background, transparency

Thread Tools
Display Modes

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
Trackbacks are On
Pingbacks are On
Refbacks are On



All times are GMT. The time now is 06:13 PM.


Camera Forum - Computer Forum - Web Design Forum

Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2012, vBulletin Solutions, Inc.
Content Relevant URLs by vBSEO 3.6.0 ©2011, Crawlability, Inc.