Solved

CSS, image size 100% and Internet Explorer

Posted on 2012-04-05
2
168 Views
Last Modified: 2012-04-28
I have images that are 100% width and height using CSS. This works beautiful in FireFox, Chrome and most browsers, but not Internet Explorer (9).  The problem in IE is that the 100% width seems to be 100% width of the screen and not the browser window.  So if I have the browser window in IE at maybe 50% of the screen, the image is stretched way beyond the browser window.

Below it is the logo that I want to stretch 100% in height and width.

<body bgcolor="#635a49" onload="MM_preloadImages('../im/home_d.gif','../im/innovation_d.gif','../im/products_d.gif','../im/news_d.gif','../im/warranty_d.gif','../im/dealerlocator_d.gif','../im/contact_d.gif')">
<table width="100%" border="0" cellspacing="0" cellpadding="1">
  <tr>
    <td bgcolor="#212121"><table width="100%" border="0" cellspacing="0" cellpadding="0">
      <tr>
        <td align="center" bgcolor="#000000"><div id="logodiv"><img src="../im/factory-logo2.jpg"   class="logostr"/></div></td>
      </tr>
      <tr>


 This is the CSS
                  
                   .logodiv {
            height:100%;
            width:100%}
       .logostr {
            height:100%;
            width:100%}
0
Comment
Question by:christer200
  • 2
2 Comments
 
LVL 7

Accepted Solution

by:
Dewmec earned 500 total points
ID: 37822330
Hi christer200,

I am hoping that I have an easy fix for you at first glance. You don't have the ending tags for the lines on both of your width properties, which may be causing the issue in IE and not the other browsers. What I mean by ending tag is shown below:

width:100%;}

Open in new window


with the " ; " added, instead of

width:100%}

Open in new window


as you currently have it. I hope this helps.
0
 
LVL 7

Expert Comment

by:Dewmec
ID: 37822342
P.S. Also, make sure you have an ending tag for table ... </table>. I'm sure you already do and it was just not part of the code you posted. Adding those couple of things to the code allows it to work properly for me at any size on the screen in the IE9 browser.
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Getting Column Height to Match Other Column 5 44
Angular JS Route 3 54
WordPress Themes 10 34
Apply tab index in forms 6 36
Browsers only know CSS so your awesome SASS code needs to be translated into normal CSS. Here I'll try to explain what you should aim for in order to take full advantage of SASS.
This article explains how to prepare an HTML email signature template file containing dynamic placeholders for users' Azure AD data. Furthermore, it explains how to use this file to remotely set up a department-wide email signature policy in Office …
In this tutorial viewers will learn how to style different bullet points for unordered lists in CSS. Begin with a normal unordered list; the default bullet point is a solid circle: In the CSS, create a defined class of unordered list by typing "ul.S…
The viewer will the learn the benefit of plain text editors and code an HTML5 based template for use in further tutorials.

867 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

12 Experts available now in Live!

Get 1:1 Help Now