2

you can see the issue in Safari on this page: http://mknepprath.com/lab/pyrus/safari_bug.html

The "See Our 2015 Graduation Lookbook" section is vertically centered in every browser except this one. I've tried quite a few ideas I've found on here, but nothing seems to work... Here's a codepen with the example below: http://codepen.io/mknepprath/pen/WbBWBQ

Here's my SSCCE:

<style>
.square {
  width: 34%;
  height: 0;
  padding-bottom: 30%;
  float: left;
  position: relative;
  background: red;
}
.table {
  display: table;
  position: absolute;
  min-height: 100%;
  height: 100%;
}
.table-cell {
  display: table-cell;
  vertical-align: middle;
}
.content {
    width: 200px;
    height: 20px;
    background: yellow;
}
</style>

<div class="square">
  <div class="table">
    <div class="table-cell">
      <div class="content"></div>
    </div>
  </div>
</div>

I want the square to scale proportionally when the browser width is decreased, so I'm currently using a padding technique, where the height of .square is set to 0, and the padding bottom is set with a percentage. An example of this is the second answer here: How to style a div to be a responsive square?

The div within that is set to display: table, and then the one within that is set to display: table-cell; vertical-align: middle. These are enough for all browsers except Safari. Any ideas?

Thanks!

Community
  • 1
  • 1
  • 1
    Please add meaningful code and a problem description here. Don't just link to the site that needs fixing - otherwise, this question will lose any value to future visitors once the problem is solved. Posting a [Short, Self Contained, Correct Example (SSCCE)](http://www.sscce.org/) that demonstrates your problem would help you get better answers. For more info, see [Something on my web site doesn't work. Can I just paste a link to it?](http://meta.stackexchange.com/questions/125997/) Thanks! – j08691 Apr 07 '15 at 19:06
  • @j08691 Thanks for the tip - I've updated my question with a more thorough example! – Michael Knepprath Apr 07 '15 at 19:21

0 Answers0