| | |
Need help to display background images using css
Please support our HTML and CSS advertiser: PostgreSQL or MySQL? Compare and contrast the two most popular open source databases
![]() |
•
•
Join Date: Apr 2004
Posts: 573
Reputation:
Solved Threads: 6
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.
and here is the css file associated with it:
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.
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)
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <html> <head> <title>Title<title> <link rel="stylesheet" type="text/css" href="styles.css" /> </head> <!Top banner of webpage> <table align="center" height="192" width="1024" class="top_table"> <tbody> </tbody> </table> <!Side navigation part of webpage> <table align="left" height="576" width="256" class="side_table"> <tbody> <!buttons go here> </tbody> </table> <!Main Content of Page tabel> <table align="right" height="576" width="768" class="main_table"> <tbody> <tr> <td height="50%"> </td> </tr> <tr> <td></td> </tr> <tr> <td height="50%"> <h2>Website Updates</h2> </td> </tr> </tbody> </table> </body> </html>
and here is the css file associated with it:
HTML and CSS Syntax (Toggle Plain Text)
table.top_table {background-image: url(images/top.jpeg);} table.side_table {background-image: url(images/side.jpeg);} 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.
Instead of using an external stylesheet, try embedding your styles between the style tags
External:
Embedded:
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
External:
HTML and CSS Syntax (Toggle Plain Text)
<head> <title>Title<title> <link rel="stylesheet" type="text/css" href="styles.css" /> </head>
Embedded:
HTML and CSS Syntax (Toggle Plain Text)
<head> <title>Title<title> <style> table.top_table { background-image: url(images/top.jpeg); } table.side_table { background-image: url(images/side.jpeg); } table.main_table { background-image: url(images/main.jpeg); } </style> </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.
try using
HTML and CSS Syntax (Toggle Plain Text)
table.top_table {background-image: url(images/top.jpeg); 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]
<profile>
<name> Sudhakar </name>
<location>India </location>
<website> http://sudhakarjha.com</website>
</profile>[/HTML]
![]() |
Similar Threads
- Desktop background not changeable -- display properties inaccessible (Viruses, Spyware and other Nasties)
- Rounded Tabs (HTML and CSS)
- Help with CSS - background extending to 100% (HTML and CSS)
- problems with tables in firefox (HTML and CSS)
- ASP display data in 3 col & rows using CSS layout (ASP)
Other Threads in the HTML and CSS Forum
- Previous Thread: making a registration page
- Next Thread: Foto attachments to/in formmail
Views: 5255 | Replies: 2
| Thread Tools | Search this Thread |
Tag cloud for HTML and CSS
2002 appointments asp background backgroundcolor beta browser bug calendar cart cgi code codeinjection corporateidentity create css deleted design development displayimageinsteadofflash dreamweaver drupal emailmarketing epilepsy explorer firefox flash font fonts form format frontpage google griefers hackers hitcounter hover html ide ie7 ie8 iframe image images internet internetexplorer intranet iphone javascript jpeg layout macbook maps marketshare microsoft missing mozilla multimedia navigationbars news offshoreoutsourcingcompany opacity opera optimization perl pnginie6 positioning problem scroll seo shopping studio swf swf. templates textcolor theme timecolor titletags url urlseparatedwords visual visualization web webdevelopment webform website windows7 wordpress xml xsl





