Jump to content

[SOLVED] Stretching Banner.


Letterbomb05

Recommended Posts

Hi,

 

I'm trying to find a decent way of creating a banner that will stretch, for compatibility with different screen resolutions. I have come up with the following HTML, however it doesn't work in IE, the middle repeating image tries to repeat on the y-axis aswell as x-axis, and therefore looks pretty bad. You can pretty much see what I'm trying to do from the source.

 

<table style="width:100%;padding:0;border-collapse:collapse;margin:0;text-align:left;">
<tr>
	<td style="width:18px;height:170px;background:url('graphics/head_left.png') no-repeat;padding:0;border-collapse:collapse;margin:0;"></td>
	<td style="height:170px;background:url('graphics/head_center.png');"> </td>
	<td style="height:170px;width:13px;background:url('graphics/head_right.png') no-repeat;"></td>
</tr>
</table>

 

If anyone has any ideas on how to fix this, or has a much better method, please share!

 

Thanks.

Link to comment
https://forums.phpfreaks.com/topic/146536-solved-stretching-banner/
Share on other sites

add a 'repeat-x' to the background CSS attribute for the middle one:

<table style="width:100%;padding:0;border-collapse:collapse;margin:0;text-align:left;">
   <tr>
      <td style="width:18px;height:170px;background:url('graphics/head_left.png') no-repeat;padding:0;border-collapse:collapse;margin:0;"></td>
      <td style="height:170px;background:url('graphics/head_center.png') repeat-x;"> </td>
      <td style="height:170px;width:13px;background:url('graphics/head_right.png') no-repeat;"></td>
   </tr>
</table>

 

but you really should get rid of those ugly tables and inline css...example coming in a sec...

<style type="text/css">
#banner {
  height: 170px;
  background: url('graphics/head_center.png') repeat-x;
}
#bannerLeft {
  float: left;
  background: url('graphics/head_left.png') no-repeat;
  width: 18px;
  height: 170px;
}
#bannerRight {
  float: left;
  background: url('graphics/head_right.png') no-repeat;
  width: 18px;
  height: 170px;
}
</style>
<div id="banner">
  <div id="bannerLeft"></div>
  <div id="bannerRight"></div>
</div>

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.