Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

img tag problems

Status
Not open for further replies.

Nic84

Technical User
Aug 1, 2007
5
GB
Hi, I'm having real trouble with getting an image to appear on my webpage. Its the first time I've properly used a css and I think there must be a problem with my coding somewhere along the line. At first, the only image I could get to appear was an image called example.jpg. Even changing its name to exampl.jpg would cause the image to not display. Now even the file example.jpg will not display. I'm pretty certain that my tags are all correct within the coding but was wondering if the style sheet could cause the page to only display certain images or no images at all?
I'm sorry if this is a really simple question, I'm using xhtml1.1 and only ever used html in the past. Any advice would be greatly appreciated.
 
No, stylesheet cannot limit the display of your images. And CSS does not play any role in displaying an image, as the content of the image tag is defined in its [tt]src[/tt] attribute. You will have to provide us with some code if you want us to really help you beyond the generic answers.

___________________________________________________________
[small]Do something about world cancer today: PACT[/small]
 
The code is quite sketchy at the moment but I can certainly post it. Would you need the stylesheet too?
 
Heres the code (I've removed the text content)

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
"<html xmlns=" xml:lang="en">
<head>
<meta http-equiv="content-type" content="text/html; charset=ISO-8859-1" />
<meta name="description" content="" />
<meta name="keywords" content="" />
<meta name="author" content="" />
<link rel="stylesheet" type="text/css" href="stylesheet.css" />
<title>Index</title>
</head>

<body>
<div id="thetop">
<a id="top"></a>
<p class="hide">Skip to: <a href="#sitemenu" accesskey="2">Site menu</a> | <a href="#maincontent" accesskey="3">Main content</a></p>
</div>

<div id="container">
<div id="main">

<div id="logo">
<h1><a href="index.html" accesskey="4"><img src="img/example.jpg" width="200" height="150" alt="Chanderlery Fandaglery" /></a></h1>
<span id="tagline"></span>
</div>

<div id="intro">
<h1><a id="maincontent"></a><center><br><font color="darkblue"><u>Chandlery<br>Fandanglery</font></center></u></h1>
<p></p>
</div><div class="clear"></div>

<h3 class="headerstyle"><marquee>Proffesionalism is the name of the game</marquee></h3>
<p></p><p class="BigHead2"></p>
<p class="BigHead2"></p>
<p class="BigHead2"></p>
<p class="BigHead2"></p></p>
<p class="internallink">[ <a href="#top">Back to top</a> ]</p>

<h3 class="headerstyle"><marquee></marquee></h3>
<p></p>
<p><br />
</p>
<p><center></center></p>
<p class="internallink">[ <a href="#top" align="center">Back to top</a> ]</p>

<h3 class="headerstyle"><marquee></marquee></h3>
<p></p>
<p class="block" align="center"></p>
<p class="internallink">[ <a href="#top">Back to top</a> ]</p>

</div>

<div id="sidebar">

<h2 class="sidelink menuheader"><a id="sitemenu"></a>Site menu:</h2>
<a class="sidelink" href="index.html">Home</a>
<span class="hide"> | </span>
<a class="sidelink" href="index.html">Products</a>
<span class="hide"> | </span>
<a class="sidelink" href="index.html">The Shop</a>
<span class="hide"> | </span>
<a class="sidelink" href="index.html">Services</a>
<span class="hide"> | </span>
<a class="sidelink" href="index.html">Contact us</a>
<span class="hide"> | </span>

<a class="hide" href="#top" accesskey="1">Top of page</a><br>

<font size="-1" color="gainsboro"><u>Ads by Nautilus Enterprises</u></font><br><br>
<p><a href=" accesskey="4"><img src="img/example.jpg" width="150" height="200" alt="Chanderlery Fandaglery" /></a><br><center><font size="-1" color="blue">themonitorshop.co.uk</center></font></p>

<h3></h3>
<p><a href=" accesskey="4"><img src="example.jpg" width="150" height="200" alt="Chanderlery Fandaglery" /></a><br><font size="-1" color="blue"><center>theinkshopuk.co.uk</center></font></p>

<h3></h3>
<p><a href=" accesskey="4"><img src="img/example.jpg" width="150" height="200" alt="Chanderlery Fandaglery" /></a><br><font size="-1" color="blue"><center></center></font></p>
</p>

</div>
<div class="clear">&nbsp;</div>
</div>

<div id="footer"><p>&copy; 2007-2008 Nautilus enterprises. </p></div>

</body>
</html>

I have placed an image called example.jpg in a folder called img at the same directory as the index.html file.
I'm pulling my hair out! I don't know what to try next! Thanks for your help.
 
Check your upper and lower case characters. Some servers are case sensitive so example.jpg is not the same as example.JPG or Example.jpg

Other than that, it's probably a path problem. If the folder "img" is at the first level of your directory structure, try using an absolute path such as
/img/example.jpg

Finally, are you sure the image itself is a Jpeg?

My money is on case sensitivity though.

<honk>*:O)</honk>

Tyres: Mine's a pint of the black stuff.
Mike: You can't drink a pint of Bovril.
 
The image is deffinately a jpeg but it shows up as JPEG image on the file information. I've tried playing around with the character case and both lower and upper isn't entertained. Would it help if I posted the css stylesheet? The background images work fine but they are .png images and placed using the stylesheet.
I've even tried changing the image to a .png file and placing that but it doesn't work, I've also tried using a few different images. Any idea why it would display a file with a certain name?
 
Could you post a link to the actual page?

<honk>*:O)</honk>

Tyres: Mine's a pint of the black stuff.
Mike: You can't drink a pint of Bovril.
 
I found a very unusual solution. By copying and pasting the code in its entire form onto a new notepad and saving it as index2.html then overwriting the index file with index2 it began to work fine! I guess thats the joys of computers.....
Thanks for yoiur help guys.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top