HTML Tutorial


 Forum HomeForum Home   FAQFAQ   SearchSearch   MemberlistMemberlist   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 
RegisterRegister - Not registered yet? Got something to say? Join HTML Code Tutorial!
Centering and not tiling a background image in a table?
Post new topic   Reply to topic    HTML Help Forum Index -> HTML Table
View previous topic :: View next topic  
Author Message
dougkaplan



Joined: 21 Jan 2005
Posts: 2

PostPosted: Fri Jan 21, 2005 9:14 am     Centering and not tiling a background image in a table? Reply with quote

Hi everyone...this is my first post of probably many involving HTML questions...

I have a table that I want to use a background on but the table size is dynamic and changes depending on the text with the table so what I want is to have the image (that is smaller than the table) to always be centered in one particular cell of a table and have it not tiled so it always appears like this..

image = background image and ignore the white lines!

___________
|__________|
|__________|
|___image__|
|__________|
|__________|

even if the table grows to be as big as this:

_____________________
|____________________|
|____________________|
|____________________|
|____________________|
|____________________|
|_______image________|
|____________________|
|____________________|
|____________________|
|____________________|
|____________________|

You get the idea. I hope I did a good job trying to explain what I want to happen and hope you can help. All the other posts I've seen have been about a background for an entire page and not a specific cell within a table.
chrisxkelley



Joined: 07 Dec 2004
Posts: 246

PostPosted: Fri Jan 21, 2005 5:25 pm     Reply with quote

try this:

Code:

<style type="text/css">
cellimg {
background-attachment:fixed;
background-position:center center;
background-repeat:no repeat;
}
</style>


just put that into your document somewhere, and put this image code in the cell
Code:

<img src="yourimage.jpg" class="cellimg">
dougkaplan



Joined: 21 Jan 2005
Posts: 2

PostPosted: Fri Jan 21, 2005 7:44 pm     Reply with quote

I was actually able to do it with this line in my HTML

Code:
<td width="438" align="left" valign="top" style="background:url('images/jgm.jpg') 50% 50% no-repeat;">


the only important part is from style="background:url to the end but thank you so much and if this doesnt contuinue to work or I want to clean up with some CSS, I will definitely try that out.
Display posts from previous:   
Post new topic   Reply to topic    HTML Help Forum Index -> HTML Table All times are GMT - 8 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
HTML Help Archive
Powered by phpBB © 2001, 2005 phpBB Group
HTML Help topic RSS feed 

 
HOSTING / DESIGN
MAKE MONEY

Home
  |   Tutorials   |   Forum   |   Quick List   |   Link Directory   |   About
Copyright ©1997-2002 Idocs and ©2002-2007 HTML Code Tutorial