• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 201
  • Last Modified:

background images

I have a bg image in a in a td but when I view it in the browswer it keeps duplicating the image like 4 more times down the page.  Even if I have content in the page I tried wrting text insert spacer gifs whats wrong heres the code. Any help will be much appreciated.

<body leftmargin="0" topmargin="0" marginwidth="0" marginheight="0">
<table width="755" height="311" border="0" align="center">
    <td height="102" align="left" valign="top"><img src="headbar.gif" width="755" height="100"></td>
    <td width="77" height="25" align="left" valign="top" background="rednav.gif"><div align="center"><a href="www.">Home</a>
        | <a href="www.">About Us</a> | <a href="www.">Welcome</a> | <a href="www.">Online
        Store</a> | <a href="www.">Classes Schedule</a> | <a href="www.">Directions</a>
        | <a href="www.">Contact</a> | <a href="www.">Email</a> </div></td>
    <td height="47" align="left" valign="top"><p><font color="#000000">Spacer text here<br>Spacer text here<br>Spacer text here<br>Spacer text here<br>Spacer text here
    <td height="21" align="left" valign="top"><font color="#000000"><img src="spacer.gif" width="45" height="45">Spacer text here<br>Spacer text here</font></td>
    <td height="7" align="left" valign="bottom"><table width="774" height="76" border="0">
          <td width="764"><hr></td>
          <td><div align="center"><font color="#FF0000">Home | About Us | Welcome
              | Online Store | Class Schedule | Directions | Contact | Email </font></div></td>
          <td height="14"><div align="center"><font color="#000000" size="1">Copyright
              &copy; / 2004 - All rights reserved - </font></div></td>
1 Solution
Try to add a style="background-repeat:no-repeat;" to the cell where you do not want the repetition to occur.

Furthermore possibly go to www.w3schools.com/css because the type of html you use (<font>) is becoming somewhat oldfashioned these days.


You can either use a style sheet for the table, or you can specify the style in the tag.  Here's an example of both ways:

background-image: url(rednav.gif);
background-repeat: no-repeat;
background-position: center center;

Then in your tag, you do this:
<td width="77" height="25" align="left" valign="top" class="my_style">

<td width="77" height="25" align="left" valign="top" style="background: url('rednav.gif') no-repeat center center;">

I'd recomment the CSS way because it's a lot more flexible and powerful.

Yes, that´ll do it:

 >> Try to add a style="background-repeat:no-repeat;" to the cell where you do not want the repetition to occur.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now