Jump to content

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>

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.