简体   繁体   中英

Layout break in IE11 but in Chrome works fine

I have this archive in my site and works fine. But when I open it in IE11 the image is not resized.

in Chrome: 1

in IE11: 在此处输入图像描述

My code:

<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css">
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.2.1/jquery.min.js"></script>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js"></script>

<div class="container">
  <ul class="nav nav-tabs">
    <li class="active"><a data-toggle="tab" href="#img">Img 1</a></li>
    <li><a data-toggle="tab" href="#imgg">Img 2</a></li>
    <li><a data-toggle="tab" href="#imge">Img 3</a></li>
    <li><a data-toggle="tab" href="#imgee">Img 4</a></li>
  </ul>

  <div class="tab-content">
    <div id="img" class="tab-pane fade in active">
      <img src='img1.png' width="90%" />
    </div>
    <div id="imgg" class="tab-pane fade">
      <img src='img2.png' width="90%" />
    </div>
    <div id="imge" class="tab-pane fade">
      <img src='img3.png' width="90%" />
    </div>
    <div id="imgee" class="tab-pane fade">
      <img src='img4.png' width="90%" />
    </div>
  </div>
</div>

<style>
  .tab-pane {
    margin-top: 10px;
  }
</style>

Someone know why the img breaks in IE11?

I have created a sample using your code, it seems that everything works well in IE browser, the screenshot like this . Please check your code, whether there have any other CSS style?

Besides,try to clear the browser data (such as:cache), and then you could try to use F12 developer tools to check the HTML elements and CSS style. Then, try to set the div container width property. such as:

<style>
    .tab-pane {
        margin-top: 10px;
    }
    .container{
        width:90%;
    }
</style>

IE11 screen width isn't supported .

You can use css rules in order to achieve that like so:

.tab-pane img{
  width: 90%;

}

Don't forget to remove the inline property from your img tags.

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