Need help to display background images using css

Reply

Join Date: Apr 2004
Posts: 573
Reputation: Dark_Omen is an unknown quantity at this point 
Solved Threads: 6
Dark_Omen Dark_Omen is offline Offline
Posting Pro

Need help to display background images using css

 
0
  #1
Jan 21st, 2006
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.
Reply With Quote Quick reply to this message  
Join Date: Dec 2004
Posts: 151
Reputation: Geek-Master is an unknown quantity at this point 
Solved Threads: 6
Geek-Master's Avatar
Geek-Master Geek-Master is offline Offline
Junior Poster

Re: Need help to display background images using css

 
0
  #2
Jan 25th, 2006
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
If in doubt, reach into the trash can and remove the user guide.
Reply With Quote Quick reply to this message  
Join Date: Jan 2006
Posts: 8
Reputation: Sudhakarj is an unknown quantity at this point 
Solved Threads: 0
Sudhakarj's Avatar
Sudhakarj Sudhakarj is offline Offline
Newbie Poster

Re: Need help to display background images using css

 
0
  #3
Jan 26th, 2006
try using
HTML and CSS Syntax (Toggle Plain Text)
  1. table.top_table {background-image: url(images/top.jpeg);
  2. background-repeat: repeat-x;}
[HTML]<?xml version="1.0" encoding="UTF-8"?>
<profile>
<name> Sudhakar </name>
<location>India </location>
<website> http://sudhakarjha.com</website>
</profile>[/HTML]
Reply With Quote Quick reply to this message  
Reply

This thread is more than three months old.
Perhaps start a new thread instead?
Message:




Views: 5255 | Replies: 2
Thread Tools Search this Thread



Tag cloud for HTML and CSS
About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC