Current location: Hot Scripts Forums » General Web Coding » HTML/XHTML/XML » Table BG Image question...


Table BG Image question...

Reply
  #1 (permalink)  
Old 06-02-05, 06:16 PM
Justin171985 Justin171985 is offline
Newbie Coder
 
Join Date: Feb 2004
Posts: 35
Thanks: 0
Thanked 0 Times in 0 Posts
Table BG Image question...

Hello,

I have a question about using <table background="images/image.gif"> with HTML 4.01 Transitional. I ran my site through the W3C Validator and it says I can't use that in the document, and should probably use CSS. I know I could use the bg image anyways, but I want it to validate properly with no errors.

The problem is, how would I go about getting a bg image to cover an entire area usin CSS, instead of the parts that have content. Cause I tried using
#bg {
background-image:
url('../images/mbg.jpg');
}

<div id="bg"></div>

and all it would cover in BG as the areas with content in it instead the entire <td>

Could someone help me with this?

Thanks,
Justin.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiShare on FacebookShare on Stumble UponShare on Twitter
Reply With Quote
  #2 (permalink)  
Old 06-03-05, 12:56 AM
rimian rimian is offline
Newbie Coder
 
Join Date: Jun 2005
Posts: 5
Thanks: 0
Thanked 0 Times in 0 Posts
you might have to include the width of your background image in the class:

#bg {
width:100px;
height:100px;
background-image:
url('../images/mbg.jpg');
}

of course those numbers are examples...

sometimes background colours and images won't render if there is no content. place a space bar in there if this is so: <div class="x">&nbsp;</div>
__________________
Web Developer
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiShare on FacebookShare on Stumble UponShare on Twitter
Reply With Quote
  #3 (permalink)  
Old 06-03-05, 05:06 PM
kjmatthews kjmatthews is offline
Wannabe Coder
 
Join Date: Jun 2004
Location: Boston, MA
Posts: 134
Thanks: 0
Thanked 0 Times in 0 Posts
Rimian is correct. A background image will only appear in the visible portion of the element to which is belongs. Since <div></div> has no implicit height or width, the background image does not appear at all. Setting height and width on the div should indeed solve your problem.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiShare on FacebookShare on Stumble UponShare on Twitter
Reply With Quote
  #4 (permalink)  
Old 06-04-05, 01:17 AM
Justin171985 Justin171985 is offline
Newbie Coder
 
Join Date: Feb 2004
Posts: 35
Thanks: 0
Thanked 0 Times in 0 Posts
Thanks I got it fixed!

Justin.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiShare on FacebookShare on Stumble UponShare on Twitter
Reply With Quote
  #5 (permalink)  
Old 06-18-05, 07:29 AM
sarat.pediredla sarat.pediredla is offline
Newbie Coder
 
Join Date: Jun 2005
Location: Newcastle upon Tyne UK
Posts: 31
Thanks: 0
Thanked 0 Times in 0 Posts
Fixed or not, I do not understand this obsession of web designers (I used to be one, so I know!) to "Validate to W3C", just because its oh-so-professional to do so. Even if that means doing the wrong thing or not understanding why you are using XHTML. If the W3C Validator says it aint right, then it aint right! right? (ermm!).

Instead of repeating the whole story, I will direct you to Mike Davidson's site who makes a lot of sense http://www.mikeindustries.com/blog/a...r-own-standard
__________________

--------------------------------
Sarat Pediredla
[Writing a lot about nothing]
Blog : Space & Beyond


<a href="http://www.spreadfirefox.com/?q=affiliates&amp;id=108865&amp;t=68"><img border="0" alt="Get Firefox!" title="Get Firefox!" src="http://sfx-images.mozilla.org/affiliates/Buttons/88x31/take.gif"/></a>
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiShare on FacebookShare on Stumble UponShare on Twitter
Reply With Quote
  #6 (permalink)  
Old 06-21-05, 01:16 AM
jordie jordie is offline
Wannabe Coder
 
Join Date: Jun 2005
Posts: 179
Thanks: 0
Thanked 0 Times in 0 Posts
I agree whole-heartedly with sarat.pediredla
__________________
Jordie Bodlay
php, mysql, postgres
css, xhtml
graphics, design
email me: jb2386@hotmail.com for any programming needs.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiShare on FacebookShare on Stumble UponShare on Twitter
Reply With Quote
Reply

Bookmarks


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
table border question timmy long HTML/XHTML/XML 5 05-23-05 10:36 AM
table question timmy long HTML/XHTML/XML 2 03-19-05 11:26 PM
Image gallery dev and a question Trel PHP 1 01-06-05 11:23 AM
how to draw an image inside a table? davidklonski HTML/XHTML/XML 2 07-06-04 11:27 AM
dynamic image src = Newbie question clintre PHP 1 10-07-03 10:56 AM


All times are GMT -5. The time now is 01:53 PM.
vBulletin® Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.