This is a discussion on "Optimizing Repeating CSS Background Images" within the Web Page Design section. This forum, and the thread "Optimizing Repeating CSS Background Images are both part of the Design Your Website category.
|
|
|
|
|
![]() |
||
Optimizing Repeating CSS Background Images
|
||
| Notices |
![]() |
|
|
LinkBack | Thread Tools |
|
#1
|
|||
|
|||
|
Optimizing Repeating CSS Background Images
I've searched for an answer to this question and haven't come up with anything yet. Using background repeat in CSS I am able to make a seemingly solid area with an image that is only a few pixels in width or height. For example, as a background to the content area in the new layout for Themebot, I set background: repeat-y, and the dimensions for the image are 994px by 1px.
I am assuming that cropping the background image down to 1px in height will use the least bandwidth to load since the image is as small as possible. However, I'm wondering how the image is repeated. This must be done on the visitors computer and I'm wondering if this would create any issues with users who have slow computers. Are there any advantages to having the height be 10px or larger as opposed to just 1px? Will the page seeming load faster if a larger image is being repeated? |
|
|
|
#2
|
|||
|
|||
|
Re: Optimizing Repeating CSS Background Images
Well, the image will only be loaded by the user's computer once, and is repeated as many times as necessary. The smaller the image, the better, since it will load faster.
Hope that helps. Cheers
Last Blog Entry: Windows Vista vs. Mac Leopard (Nov 4th, 2007)
|
|
#3
|
||||
|
||||
|
Re: Optimizing Repeating CSS Background Images
If you are using an image to simply represent a solid colour, then use
Last Blog Entry: The Google Misconception (Feb 3rd, 2008)
|
|
#4
|
|||
|
|||
|
Re: Optimizing Repeating CSS Background Images
Last Blog Entry: Happy New Year! (Dec 31st, 2007)
|
|
#5
|
|||
|
|||
|
Re: Optimizing Repeating CSS Background Images
The only time I use an image for solid color is to compensate for shoddy PNG support among different browsers. It seems that the browser has to work harder to render a background with a single pixel height as opposed to multiple pixels in height. Need to experiment a little to find the best trade-off.
|
|
#6
|
||||
|
||||
|
Re: Optimizing Repeating CSS Background Images
I generally don't keep image dimensions less than 10 pixels if it's repeating. Especially if it's something like 1px by 1px, the browser has to repeat it millions and millions of times. For the most part, it doesn't really matter, but that added 9 pixels might speed up the website for what little extra bandwidth it will initially take.
|
|
#7
|
||||
|
||||
|
Re: Optimizing Repeating CSS Background Images
Quote:
You can fix this using TweakPNG and simply deleting the GAMA chunk of the file
Last Blog Entry: The Google Misconception (Feb 3rd, 2008)
|
|
#8
|
|||
|
|||
|
Re: Optimizing Repeating CSS Background Images
I was aware of TweakPNG but never tried it. Might have to give it a go on the next project that needs the tweak. Thanks!
Back to the issue of browser generation. I resized a background image I'm using from 994x1 to 994x108. The filesize increased from around 300bytes to around 600bytes. Still very small. Since it only needs to be downloaded once and is then cached, I think this is better than having the browser redraw the entire area using a 1px height image each time somebody browses to a new page. I'd like to see some benchmarks on this, and I'm sure there is variance between browsers. Not sure how to go about benchmarking though. |
![]() |
| Thread Tools | |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Is it possible to have 2 background images? | lmc148 | Web Page Design | 8 | Jun 17th, 2008 01:46 |
| repeating background issues. | Therealmatt | Starting Out | 4 | Sep 20th, 2007 22:54 |
| Disappearing Background Images (IE6) | kidreapertronV | Web Page Design | 14 | Jun 8th, 2007 16:45 |
| Repeating an image along the bottom of the page without setting it as background. | imagius | Web Page Design | 9 | Apr 27th, 2007 08:35 |
| Is it possible to have 2 repeating background images? | dragonator | Web Page Design | 1 | Dec 9th, 2005 00:09 |