Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

No repeat background

Status
Not open for further replies.

iluvperl

Programmer
Jan 22, 2006
107
Can someone give me the inline code to make a background image in a TD cell not repeat? I found lots of examples in CSS but not a complete one that showed me how to use it in a table. The examples where just for BODY tags.

I need it for a <td> tag
 
It's been a while but I think you can put "Backgroun-repeat:no repeat" inside the body tags.
 
So..

Code:
<td background="image.gif" background-repeat: norepeat;>
</code>
?
 
No.. It's supposed to be.
Code:
<td style="background-image:url( image.gif ); background-repeat:no-repeat">
Or even better
Code:
<style type="text/css">
<!--
.image_test {
	background-image: url( image.gif );
	background-repeat: no-repeat;
}
-->
</style>

<td class="image_test">

M. Brooks
 
Here's a very quick example:

Code:
<html>
<head>
	<style type="text/css">
		div {
			background-color: red;
			<!-- the next line should turn the background gold instead of red -->
			background-color: gold;
		}
	</style>
</head>
<body>
	<div>
		Lorum ipsum dolor sit amet&hellip;
	</div>
</body>
</html>

If the comment really was a comment, the background would be gold, but it is not in any of the browsers I tested in:

IE 5.0, 5.5, 6.0/Win
Firefox 1.5.0.3/Win
Netscape 7.2/Win
Opera 7.02, 7.54u2, 8.52/Win

I didn't test it under any Mac OS X browsers, but I suspect they would act the same.

If the comment is changed to the correct style for CSS comments (/* ... */), then the gold background is present, as expected.

Dan



Coedit Limited - Delivering standards compliant, accessible web solutions

[tt]Dan's Page [blue]@[/blue] Code Couch
[/tt]
 
Sorry Billy Ray.. but the example I posted has nothing to do with the example you posted. The comment block is used in the case the viewer doesn't support CSS. Works the same as the Javascript comment as explained below.
Code:
<style type="text/css">
<!--

-->
</script>

<script type="text/javascript">
<!--//

//-->
</script>
As in both cases if the style or script type are not supported. Their contents don't break the browser.

M. Brooks
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top