Tycoon Talk
Become a Big fish!
The number 1 forum for online business!
Post topics, ask questions, share your knowledge.
Tycoon Talk is part of Freelancer.com - find skilled workers online at a fraction of the cost.

CSS Forum


You are currently viewing our CSS Forum as a guest. Please register to participate.
Login



Reply
why wont my image show up :(
Old 06-18-2007, 01:49 PM why wont my image show up :(
Average Talker

Posts: 15
Trades: 0
hi could somebody please help me. in my css code ive declared a background image but it does not show. what am i doing wrong. its the "#header" that wont show.

this is my css code:
Code:
body { 

  margin:0px; 
  text-align: center; 
  color: white; 
  background: #aed0e4 url('images/background.gif') repeat-x fixed top left;
  
}   

#container
{
          width: 752px;
          margin: 0px auto;
          text-align: left;
          border-left: 1px solid #999999;
          border-right: 1px solid #999999;

}

#header

{
  width: 752px;
  background: url ('images/top_bg.jpg');
  background-repeat: no-repeat;
  
  
}
and this is my html code
Code:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
   "http://www.w3.org/TR/html4/strict.dtd">
<html>
  <head>
  
  <title>Portfolio v1</title>
  <link href="layout.css" rel="stylesheet" type="text/css">
  </head>
  
  <body>
  
    <div id= "container">
    
    <div id = "header">
    
    
    </div>
    
    
    
    </div>
    
  </body>
</html
any help would be appreciated. thanks again
monkeymafia is offline
Reply With Quote
View Public Profile
 
 
Register now for full access!
Old 06-18-2007, 01:53 PM Re: why wont my image show up :(
angele803's Avatar
Perfectly Imperfect

Posts: 1,772
Name: Stephanie
Location: Oklahoma
Trades: 2
I think you will need to declare a height for the header. Since there is no content in the header div, some browsers can't figure out how tall to make the background image.
angele803 is offline
Reply With Quote
View Public Profile
 
Old 06-18-2007, 01:58 PM Re: why wont my image show up :(
Average Talker

Posts: 15
Trades: 0
hi
thanks for the reply, i added a height of 600px but it only extended the left and right border for the container, still no image.
monkeymafia is offline
Reply With Quote
View Public Profile
 
Old 06-18-2007, 02:00 PM Re: why wont my image show up :(
angele803's Avatar
Perfectly Imperfect

Posts: 1,772
Name: Stephanie
Location: Oklahoma
Trades: 2
You need to declare a height for the header div, not the whole page.
Try this:
Code:
#header

{
  width: 752px;
  background: url ('images/top_bg.jpg');
  background-repeat: no-repeat;
  height: 100px;
}
Put the actual height of the image where I put "100px"
angele803 is offline
Reply With Quote
View Public Profile
 
Old 06-18-2007, 02:06 PM Re: why wont my image show up :(
Average Talker

Posts: 15
Trades: 0
yes thats what I did :P i dont know why it changes the size of the left and right border because thats the container. this is so frustrating :/
monkeymafia is offline
Reply With Quote
View Public Profile
 
Old 06-18-2007, 02:58 PM Re: why wont my image show up :(
LadynRed's Avatar
Defies a Status

Posts: 10,017
Location: Tennessee
Trades: 0
1 - take the quote marks out of the path in following the url('xxxxx'). You don't need them and they can go haywire on you.

Further, the syntax should be background: url(images/top.jpg) no-repeat; - no spaces.

Adding a height should not affect the left and right margins whatsoever.
__________________
Web Goddess & Web Standards Evangelist :) - Tables Be Gone !!

Please login or register to view this content. Registration is FREE


Please login or register to view this content. Registration is FREE

LadynRed is offline
Reply With Quote
View Public Profile
 
Old 06-18-2007, 03:13 PM Re: why wont my image show up :(
Average Talker

Posts: 15
Trades: 0
thanks for the reply ladynred. but that did not work also. its so something so simple i just dont understand why it doesnt work
monkeymafia is offline
Reply With Quote
View Public Profile
 
Old 06-18-2007, 07:56 PM Re: why wont my image show up :(
tripy's Avatar
Do not try this at home!

Posts: 3,621
Name: Thierry
Location: I'm the uber Spaminator !
Trades: 0
You use a relative path in your CSS rule, so, are you sure the file exists relatively from the current path ?

Deeper explaination:
you have an images directory in the root folder.
If you access a page at the root level, the browser will find the file.
But if you are in a subfolder, the browser will try to look for "subfolder/images/file.jpg", and that could be your problem.

And as a reminder:
Code:
/images/file.jpg   ==> The file named "file.jpg", in a folder placed on the site root level
images/file.jpg    ==> The file named "file.jpg" placed in a subfolder named "images" at the current place
../images/file.jpg ==> The file named "file.jpg" placed in the folder 1 level up of the current, if possible, or current if we are on the root level
__________________
Only a biker knows why a dog sticks his head out the window.
tripy is offline
Reply With Quote
View Public Profile Visit tripy's homepage!
 
Old 06-19-2007, 05:10 AM Re: why wont my image show up :(
Ultra Talker

Posts: 256
Location: Auckland, New Zealand
Trades: 0
First of all, the attributes in your HTML aren't correctly formed.

Always do <tag attrib="value"> and not <tag attrib = "value">

Cheers,

MC
__________________
#------------------------------signature---------------------------------------------------------------------------------#
Quote:
I am well recognised for what I don't do than what I do. Chores are just one of those things.
mastercomputers is offline
Reply With Quote
View Public Profile Visit mastercomputers's homepage!
 
Old 06-19-2007, 11:10 AM Re: why wont my image show up :(
Average Talker

Posts: 15
Trades: 0
thanks for the replies. ive cleaned up the tags. and also im sure the directory is correct because the first 'images/background.gif' loads fine. and the mainbg is in the same directory.
monkeymafia is offline
Reply With Quote
View Public Profile
 
Old 06-19-2007, 11:11 AM Re: why wont my image show up :(
karinne's Avatar
Extreme Talker

Posts: 197
Location: Quebec, Canada
Trades: 0
Give us a link then!
__________________

Please login or register to view this content. Registration is FREE
-
Please login or register to view this content. Registration is FREE
-
Please login or register to view this content. Registration is FREE
-
Please login or register to view this content. Registration is FREE
-
Please login or register to view this content. Registration is FREE


Getting on the Web Standards band-wagon? Get these books -
Please login or register to view this content. Registration is FREE
and
Please login or register to view this content. Registration is FREE


Takin' in the view from the outside. Feeling like the underdog. Watching through the window I'm on the outside. Living like the underdog.
-Dream Theater
karinne is offline
Reply With Quote
View Public Profile Visit karinne's homepage!
 
Reply     « Reply to why wont my image show up :(
 

Thread Tools Search this Thread
Search this Thread:

Advanced Search

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 On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off





   
RSS Feed  Feeds: RSS   JS   XML
RSS Feed  Feeds for this forum: RSS   JS   XML



Page generated in 0.34718 seconds with 12 queries