简体   繁体   中英

images won't display in IE9

The image code below works fine in Mozilla, Chrome and Safari but doesn't display in IE9.

It is saved as an image in photoshop for websites and I specified the height and width.

When I write it like this without the slash before "D:"

<img src="D:/obrazki/game.jpg" alt="game" width="1100" height="619" /> 

it works in IE but then it doesn't display in Mozilla.

<img src="/D:/obrazki/game.jpg" alt="game" width="1100" height="619" />

this code works fine in all browsers apart from IE

<img src="D:/obrazki/game.jpg" alt="game" width="1100" height="619" /> 

this one works fine in all apart from Mozilla

this is the whole div and there is not css style yet.

<section class="container">

     <div class="image_carousel">
     <div id="foo2">
    <img src="/D:/obrazki/game.jpg" alt="game" width="1100" height="619" />

     </div>
     </article>

</section>

Do you think it is the extension problem and I should save the image as GIF not jpg. ?

and if I wanted to create separate code for IE would it work if I make comments like these below in my html file? and put the image code inside those comments for IE9?

             <!--[if IE]>

            <![endif]-->

Shouldn't the image call be:

<img src="/obrazki/game.jpg" alt="game" width="1100" height="619" />

?

Or better yet:

<img src="/obrazki/images/game.jpg" alt="game" width="1100" height="619" />

Where /obrazki would be where you have the pages/scripts to "call" your images..

如何链接到相对路径上的图像:

<img src="./link/to/image.jpg"/>

ok, lets do an old and dirty solution...serve up the images for non-ie(s), then serve up the images for ie(s) via conditional comments. (sidenote: there's a few ways to do this, like using a background-image on a wrapper element around the image, but since you are relying on img elements, i'll stick to that method. so

  
<section class="container">  
  <article>  
    <div class="image_carousel">  
      <div id="foo2">  
        <img src="/D:/obrazki/game.jpg" alt="game" width="1100" height="619" />  
        <!--[if lte IE 9]><img src="D:/obrazki/game.jpg" alt="game" width="1100" height="619" /><![endif]-->  
      </div>  
    </div>  
  </article>  
</section>  

that should work...in theory. you may have fouc or positioning issues, though i doubt the fouc...it's hard to tell without seeing it live, with the rest of the document.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM