944,021 Members | Top Members by Rank

Ad:
Jan 21st, 2006
0

Need help to display background images using css

Expand Post »
Hello,

I am trying to create a website, but I have ran into a snag, I can't get the images to display in the background using css. I have looked at some tutorials and did exactly what they said to do and it still hasn't worked.

Here is what I have.

This is the HTML code for my website.
HTML and CSS Syntax (Toggle Plain Text)
  1. <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
  2. "http://www.w3.org/TR/html4/loose.dtd">
  3.  
  4. <html>
  5. <head>
  6. <title>Title<title>
  7. <link rel="stylesheet" type="text/css" href="styles.css" />
  8. </head>
  9.  
  10. <!Top banner of webpage>
  11. <table align="center" height="192" width="1024" class="top_table">
  12. <tbody>
  13. </tbody>
  14. </table>
  15.  
  16. <!Side navigation part of webpage>
  17. <table align="left" height="576" width="256" class="side_table">
  18. <tbody>
  19.  
  20. <!buttons go here>
  21. </tbody>
  22. </table>
  23.  
  24. <!Main Content of Page tabel>
  25. <table align="right" height="576" width="768" class="main_table">
  26. <tbody>
  27. <tr>
  28. <td height="50%">
  29. </td>
  30. </tr>
  31.  
  32. <tr>
  33. <td></td>
  34. </tr>
  35.  
  36. <tr>
  37. <td height="50%">
  38. <h2>Website Updates</h2>
  39.  
  40. </td>
  41. </tr>
  42. </tbody>
  43. </table>
  44. </body>
  45. </html>

and here is the css file associated with it:
HTML and CSS Syntax (Toggle Plain Text)
  1. table.top_table {background-image: url(images/top.jpeg);}
  2. table.side_table {background-image: url(images/side.jpeg);}
  3. table.main_table {background-image: url(images/main.jpeg);}

The images are located in a file called images, and the main html, css, and image folder are all in the same folder.

Thanks for the help.
Similar Threads
Reputation Points: 23
Solved Threads: 6
Posting Pro
Dark_Omen is offline Offline
573 posts
since Apr 2004
Jan 25th, 2006
0

Re: Need help to display background images using css

Instead of using an external stylesheet, try embedding your styles between the style tags

External:

HTML and CSS Syntax (Toggle Plain Text)
  1. <head>
  2. <title>Title<title>
  3. <link rel="stylesheet" type="text/css" href="styles.css" />
  4. </head>

Embedded:

HTML and CSS Syntax (Toggle Plain Text)
  1. <head>
  2. <title>Title<title>
  3. <style>
  4. table.top_table {
  5. background-image: url(images/top.jpeg);
  6. }
  7. table.side_table {
  8. background-image: url(images/side.jpeg);
  9. }
  10. table.main_table {
  11. background-image: url(images/main.jpeg);
  12. }
  13. </style>
  14. </head>

This way if it works, you know that it has something to do with linking to the external stylesheet.

Else, you might need to double check your paths for the image url.

You might need to use the short version of the image extension. Instead of .jpeg use .jpg
Reputation Points: 12
Solved Threads: 6
Junior Poster
Geek-Master is offline Offline
156 posts
since Dec 2004
Jan 26th, 2006
0

Re: Need help to display background images using css

try using
HTML and CSS Syntax (Toggle Plain Text)
  1. table.top_table {background-image: url(images/top.jpeg);
  2. background-repeat: repeat-x;}
Reputation Points: 10
Solved Threads: 0
Newbie Poster
Sudhakarj is offline Offline
8 posts
since Jan 2006

This thread is more than three months old

No one has posted to this discussion for at least three months. Please let old threads die and do not reply to them unless you feel you have something new and valuable to contribute that absolutely must be added to make the discussion complete. Otherwise, please start a new thread in this forum instead.
Message:
Previous Thread in HTML and CSS Forum Timeline: making a registration page
Next Thread in HTML and CSS Forum Timeline: Foto attachments to/in formmail





About Us | Contact Us | Advertise | Acceptable Use Policy
Forum Index | Build Custom RSS Feed


Follow us on Twitter


© 2011 DaniWeb® LLC