| | |
Shadow / background
Please support our HTML and CSS advertiser: PostgreSQL or MySQL? Compare and contrast the two most popular open source databases
Thread Solved |
0
#2 Oct 10th, 2009
1. create your png background image.
this will be a couple of pixels wider than the width of your actual site. the extra width is dependent on how wide your shadow is. so if your shadow is 10px wide and your site is 900px wide, your image will be 920px wide. you will have to have the shadow lie within 10px on the left and 10px on the right of the image with 900px of transparency in between. you will tile this image vertically so cut the length to 1px after creating it.
in my example i will name this image shadow.png
2. here is the example html
and css
this will be a couple of pixels wider than the width of your actual site. the extra width is dependent on how wide your shadow is. so if your shadow is 10px wide and your site is 900px wide, your image will be 920px wide. you will have to have the shadow lie within 10px on the left and 10px on the right of the image with 900px of transparency in between. you will tile this image vertically so cut the length to 1px after creating it.
in my example i will name this image shadow.png
2. here is the example html
HTML and CSS Syntax (Toggle Plain Text)
<body id="page"> <div id="wrap"> <div id="site"> </div> </div> </body>
HTML and CSS Syntax (Toggle Plain Text)
#page {background-color:#fff;} #wrap {width:920px; background: url (..images/shadow.png) center top repeat-y;} #site {margin:0 10px;}
Last edited by urolicious; Oct 10th, 2009 at 8:28 pm.
1
#4 Oct 12th, 2009
yes... i used a color on #page as an example but you can use an image as well. so it can be as so:
page-bg.png - background on the body of the site
shadow.png - background on the div#wrap
HTML and CSS Syntax (Toggle Plain Text)
#page {background: url (..images/page-bg.png) top left repeat-x;} #wrap {width:920px; background: url (..images/shadow.png) center top repeat-y;} #site {margin:0 10px;}
shadow.png - background on the div#wrap
•
•
Join Date: Jun 2006
Posts: 67
Reputation:
Solved Threads: 0
0
#5 Oct 12th, 2009
I don't know if I'm doing anything wrong but I can manage to get it to work.
I've followed what you've written and I can see in my HTML editor (Dreamweaver) that there has been a div created around it and my main background is also added in correctly, but unfortunately the "shadow.png" part doesn't show (only the div where it's supposed to be).
I've tried som trail and error by changing the size of the picture, unfortunately I'm stuck.
Thanks for all the help so far..
I've followed what you've written and I can see in my HTML editor (Dreamweaver) that there has been a div created around it and my main background is also added in correctly, but unfortunately the "shadow.png" part doesn't show (only the div where it's supposed to be).
I've tried som trail and error by changing the size of the picture, unfortunately I'm stuck.

Thanks for all the help so far..
•
•
Join Date: Jun 2006
Posts: 67
Reputation:
Solved Threads: 0
0
#7 Oct 12th, 2009
HTML and CSS Syntax (Toggle Plain Text)
<html><head><title>Test</title> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"> <style type="text/css"> #page {background: url(mainbackground.jpg) top left repeat-x;} #wrap {width:920px; background: url (shadow.png) center top repeat-y;} #site {margin:0 10px;} </style> </head> <body id="page"> <div id="wrap"> <div id="site"> <table border="0" width="100%"> </table><table width="946" height="64" align="center" cellpadding="0" cellspacing="4"> <tbody><tr> <td width="904" height="57" bgcolor="#000000"> </td> </tr> </tbody></table> <center> <table border="0" cellpadding="0" cellspacing="0" width="920"> <tbody><tr> <td width="933"><table align="center" bgcolor="#ffffff" border="0" bordercolor="#ffffff" cellpadding="1" height="887" width="946"> <tbody> </tbody> <tbody> <tr> <td align="left" height="755" valign="top" width="920"> </td> </tr> </tbody> <tbody> </tbody> </table></td> </tr> </tbody></table> </div> </div> </center> </body> </html>
Would be too long to post the entire code so I deleted the content and only kept the parts that's relevant.
0
#8 Oct 12th, 2009
•
•
•
•
HTML and CSS Syntax (Toggle Plain Text)
<html><head><title>Test</title> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"> <style type="text/css"> #page {background: url(mainbackground.jpg) top left repeat-x;} #wrap {width:920px; background: url (shadow.png) center top repeat-y;} #site {margin:0 10px;} </style> </head> <body id="page"> <div id="wrap"> <div id="site"> <table border="0" width="100%"> </table><table width="946" height="64" align="center" cellpadding="0" cellspacing="4"> <tbody><tr> <td width="904" height="57" bgcolor="#000000"> </td> </tr> </tbody></table> <center> <table border="0" cellpadding="0" cellspacing="0" width="946"> <tbody><tr> <td width="933"><table align="center" bgcolor="#ffffff" border="0" bordercolor="#ffffff" cellpadding="1" height="887" width="946"> <tbody> </tbody> <tbody> <tr> <td align="left" height="755" valign="top" width="920"> </td> </tr> </tbody> <tbody> </tbody> </table></td> </tr> </tbody></table> </div> </div> </center> </body> </html>
Would be too long to post the entire code so I deleted the content and only kept the parts that's relevant.
1. it looks like your site is supposed to be 946px wide therefore your shadow.png should be 966px wide provided your shadow is 10px.
so your CSS should be as follows:
HTML and CSS Syntax (Toggle Plain Text)
#page { background: url(mainbackground.jpg) top left repeat-x; } #wrap { width:966px; background: url (shadow.png) center top repeat-y; } #site { margin:0 10px; }
2. you're using <center> in your html which you shouldn't as it has been deprecated.
are you using this to center your site? if you are, consider adding the code below to your current css instead:
HTML and CSS Syntax (Toggle Plain Text)
#page { text-align:center; } #wrap { margin:0 auto; text-align:left; }
•
•
Join Date: Jun 2006
Posts: 67
Reputation:
Solved Threads: 0
0
#9 Oct 14th, 2009
The shadow image (shadow.png - Yes, it's created in Photoshop. I've also tried with a .jpg image) is 966px wide and this is the code I use:
Unfortunately the same problem occur; I can only see my main background (main.jpg), no shadow (shadow.png) what so ever is visible in the page - but I can see the div (10 px on each side) on the side in my HTML Editor (Dreamweaver), so the problem can't be there. Must be something wrong in one of the three parts of the CSS.
There's also another problem - the main background (main.jpg) is not shown from top to bottom, only half way. If I use normal HTML code (<body background, etc) there's no problem.
Thanks for all the help so far.
Robin
HTML and CSS Syntax (Toggle Plain Text)
<html><head><title>Test</title> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"> <style type="text/css"> #page { background: url(main.jpg) top left repeat-x; text-align:center; } #wrap { width:966px; background: url (shadow.png) center top repeat-y; margin:0 auto; text-align:left; } #site { margin:0 10px; } </style> </head> <body id="page"> <div id="wrap"> <div id="site"> <table border="0" width="100%"> </table><table width="946" height="64" align="center" cellpadding="0" cellspacing="4"> <tbody><tr> <td width="904" height="57" bgcolor="#000000"> </td> </tr> </tbody></table> <table border="0" cellpadding="0" cellspacing="0" width="946"> <tbody><tr> <td width="933"><table align="center" bgcolor="#ffffff" border="0" bordercolor="#ffffff" cellpadding="1" height="887" width="946"> <tbody> </tbody> <tbody> <tr> <td align="left" height="755" valign="top" width="920"> </td> </tr> </tbody> <tbody> </tbody> </table></td> </tr> </tbody></table> </div> </div> </div> </body> </html>
Unfortunately the same problem occur; I can only see my main background (main.jpg), no shadow (shadow.png) what so ever is visible in the page - but I can see the div (10 px on each side) on the side in my HTML Editor (Dreamweaver), so the problem can't be there. Must be something wrong in one of the three parts of the CSS.
There's also another problem - the main background (main.jpg) is not shown from top to bottom, only half way. If I use normal HTML code (<body background, etc) there's no problem.
Thanks for all the help so far.
Robin
Last edited by ytregnn; Oct 14th, 2009 at 4:22 pm.
![]() |
Similar Threads
- BUG in Internet Explorer. Please help find a solution! (HTML and CSS)
- CSS Border's Shadow ??? (HTML and CSS)
- Making Webpages that conform to the users resolution (Site Layout and Usability)
- Hijack this log Re: desktop background (Viruses, Spyware and other Nasties)
- Need help on centering (HTML and CSS)
- Single Table Cell background (HTML and CSS)
- Gif and transparency (Site Layout and Usability)
Other Threads in the HTML and CSS Forum
- Previous Thread: Help From Css Experince Developer
- Next Thread: How to declare the mime type for a html-email?
| Thread Tools | Search this Thread |
appointments asp background backgroundcolor beta browser bug calendar cart cgi code codeinjection corporateidentity css design development displayimageinsteadofflash dreamweaver emailmarketing epilepsy explorer firefox flash form format google griefers hackers hitcounter hover html ide ie7 ie8 iframe image images internet internetexplorer intranet iphone javascript jpeg layout macbook maps marketshare microsoft mozilla multimedia navigationbars news offshoreoutsourcingcompany opacity opera optimization pnginie6 positioning problem scroll seo shopping studio swf swf. textcolor timecolor titletags url urlseparatedwords visual visualization web webdevelopment webform website windows7





