Web Development
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
 
User Name:
Password:
Remember me
 
Go Back   Dev Articles Community ForumsWeb DesignWeb Development

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Display Modes
 
Unread Dev Articles Community Forums Sponsor:
Ajax Application Generator Generate database and reporting .NET Web apps in minutes. Quickly create visually stunning, feature-rich apps that are easy to customize and ready to deploy. Download Now!
  #1  
Old August 16th, 2005, 04:28 PM
MakoHaze MakoHaze is offline
Registered User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Aug 2005
Posts: 2 MakoHaze User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 15 m 59 sec
Reputation Power: 0
Need some Help with Backgrounds

SO, I'm making a site that I want to be centered in the navigator window, and on either side of the site (that is primarily one big table) I want to have two seperate background images, the one on the right aligned to the left and the one on the left side of the table aligned at right. The reason being that the background images in either side fade outward to the left and right respectively.

Can ANYONE help me out?

Again, for clarification, what I need is a way to create a tiling background image on the left side of my site and a different tiling background image on the right side.

How can I do this? And if the only way to do it is with CSS, how might I do it using CSS? Any help would be appreciated!

Reply With Quote
  #2  
Old August 17th, 2005, 05:56 AM
MichaelSoft MichaelSoft is offline
Contributing User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Aug 2005
Location: The Netherlands
Posts: 121 MichaelSoft User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 17 h 20 sec
Reputation Power: 3
Arrow

It is not possible to have two different images in one background-layer. But there are various workarounds to your problem. Depending on how 'strict' you want to have your page and in which browsers it must work.

The most simple one is using a table to center your content, and using its cells to put the background.

This will center the contents horizontally. To center vertically, just add a row at the top and at the bottom.
Code:
<table>
  <tr>
    <td style='width:50%; background: url(image/back-left.jpg) repeat-y left'></td>
    <td style='white-space:nowrap'>
      The contents of your page
    </td>
    <td style='width:50%; background: url(image/back-right.jpg) repeat-y right'></td>
  </tr>
</table>


You could also position floating (page-height) DIV's containing the backgrounds...

Anyway, the CSS-code above shows how to align a background image. This works for basically all elements...

Reply With Quote
  #3  
Old August 17th, 2005, 12:10 PM
MakoHaze MakoHaze is offline
Registered User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Aug 2005
Posts: 2 MakoHaze User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 15 m 59 sec
Reputation Power: 0
Quote:
Originally Posted by MichaelSoft
It is not possible to have two different images in one background-layer. But there are various workarounds to your problem. Depending on how 'strict' you want to have your page and in which browsers it must work.

The most simple one is using a table to center your content, and using its cells to put the background.

This will center the contents horizontally. To center vertically, just add a row at the top and at the bottom.
Code:
<table>
  <tr>
    <td style='width:50%; background: url(image/back-left.jpg) repeat-y left'></td>
    <td style='white-space:nowrap'>
      The contents of your page
    </td>
    <td style='width:50%; background: url(image/back-right.jpg) repeat-y right'></td>
  </tr>
</table>


You could also position floating (page-height) DIV's containing the backgrounds...

Anyway, the CSS-code above shows how to align a background image. This works for basically all elements...


Alright, the code looks sound, but I couldn't get it to work quite right, and while I'm new to HTML and CSS, I'm not new to programming, so is there anything I need to declare in order for the browser to know that CSS is being used? Because the rest of my page is straight HTML except for the <style> block at the top.

Reply With Quote
  #4  
Old August 17th, 2005, 01:21 PM
MichaelSoft MichaelSoft is offline
Contributing User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Aug 2005
Location: The Netherlands
Posts: 121 MichaelSoft User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 17 h 20 sec
Reputation Power: 3
Talking

What didn't work quite right?
It works (ofcourse) on my side...

Have a look at the attachment, this works on Win IE 6 and FireFox, but I'm sure it works on many others.

There is no need to tell the browser that you will be using CSS. Its is enabled by default. My example uses "inline style definition", but you can easily change this to another type (external style sheet, or in your <style> block).
Attached Files
File Type: zip test.zip (1.0 KB, 273 views)

Reply With Quote
Reply

Viewing: Dev Articles Community ForumsWeb DesignWeb Development > Need some Help with Backgrounds


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  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

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 5 hosted by Hostway