1

I have a basic setup to center an oversized image in it's container. It works perfectly except when you try and print Chrome (Printing in FF and IE works as expected). Instead, Chrome's print preview will not resize the image at all.

Annoyingly I am unable to recreate the problem, so I hope someone might be able to suggest something it could be?

This is the basic setup: https://jsfiddle.net/aed2gh3w/

<style>
.container {
  position:relative;
  width:20%;
  padding-bottom:20%;
  border:1px solid red;
  margin:0 auto;

}

.align {
  position:absolute;
  left:50%;
  margin:0 -400px;
  top:0;
  width:800px;
  height:100%;
  border:none;
  text-align:center;
}

img {
  vertical-align:top;
  height:100%;
  width:auto;
}

</style>
<div class="container">
  <div class="align">
    <img src="http://placehold.it/400x300">
  </div>
</div>
user500665
  • 1,220
  • 1
  • 12
  • 38

1 Answers1

0

Turns out the problem was because I didn't have a height set for .container Even though there is no height, because it's all padding, I still needed to add height:0; to it's style or else Chrome would get confused half of the time.

user500665
  • 1,220
  • 1
  • 12
  • 38