WebProWorld Part of WebProNews.com
Page One Link To Us Edit Profile Private Messages Archives FAQ RSS Feeds  
 

Go Back   WebProWorld > Site Design > Graphics & Design Discussion Forum
Subscribe to the Newsletter FREE!


Register FAQ Members List Calendar Arcade Chatbox Mark Forums Read

Graphics & Design Discussion Forum Post your graphics design questions/comments/ideas in here. Ask questions, post tutorials, discuss trends and best practices. Sub-forum for website accessibility and usability.

Reply
 
LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 10-13-2006, 09:18 AM
WebProWorld Pro
 

Join Date: Jan 2004
Location: Empangeni, South Africa
Posts: 124
justinw RepRank 0
Default CSS for background resize

Hi all,

I have a logo with a transparent background. It is placed over an image with a fade effect (see http://www.homezoneproperty.co.za/dev/index.php)

I would to have the faded green background resize to fill the whole top no matter the screen size.

How can I do this?
__________________
Website designs in Empangeni, South Africa: www.jwdesigns.co.za
Reply With Quote
  #2 (permalink)  
Old 10-13-2006, 10:05 AM
arvana's Avatar
WebProWorld Pro
 

Join Date: Jul 2003
Location: Guelph, Ontario, Canada
Posts: 157
arvana RepRank 0
Default

I would do it with layers:

img.background {z-index:10; width:100%}
img.header {z-index:20}

I don't work with tables much anymore, so I'm not 100% sure that this works within a table cell, but it's worth a try!
__________________
Arvana
arvanadesign.com
Reply With Quote
  #3 (permalink)  
Old 10-15-2006, 02:27 AM
WebProWorld Pro
 

Join Date: Oct 2003
Location: Alberta, Canada
Posts: 222
weegillis RepRank 1
Default

You could try using an oversized image, then center it with the CSS. Your image could be as little as 5 to 10 pixels high, depending on quality, then repeat-y. Very few displays are more than 1600 pixels wide, so that could be your ceiling. Just extend the darkest regions right and left to achieve the length you need.
Code:
.headerback {
	background: #fff url('../images/back.jpg') repeat-y 50% 0%;
	]
This method reduces quality loss that may result from stretching the original image. Your main view will always be centered in (almost) any viewport width. It's kind of like overflow:hidden; but it's done automatically. Only as much of the image that can be displayed (based on parent container) will be displayed, the rest is simply truncated.

To be sure that your image always looks correct, (at least in non-IE) you could give the wrapping table a max-width of 1600px and let the page fill in naturally.

For the record, most browsers support image scaling. Simply make the img width="100%" and leave out the height. The image will stretch to fit the width of the parent container. Height will vary, according to final width.

If you include the height, the image may distort due to uneven scaling. I know this goes against the grain, and relies on the browser to perfom the necessary calculations, thereby slowing down the page, but it's a method that works, nonetheless, though probably not in this case due to fixed vertical size.
__________________
Volunteer for something in your community today!
Reply With Quote
Reply

  WebProWorld > Site Design > Graphics & Design Discussion Forum
Tags: , ,



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

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Search Engine Optimization by vBSEO 3.2.0