Skip to content

Instantly share code, notes, and snippets.

@starryeyez024
Last active August 29, 2015 14:10
Show Gist options
  • Save starryeyez024/1eb234dcb5fbd5e8b4da to your computer and use it in GitHub Desktop.
Save starryeyez024/1eb234dcb5fbd5e8b4da to your computer and use it in GitHub Desktop.
Generated by SassMeister.com.
<div class="ratio">
<div class="fpp">
<div class="fpp-inner">
<div class="field--name-field-fpp-text-body"> More text perhaps, was on the dockett, we could never be sure. How many words will need to fit in the box?</div>
<div class="field--name-field-fpp-text-url"> And what if there's more? What then?</div>
</div>
</div>
</div>
// ----
// Sass (v3.4.7)
// Compass (v1.0.1)
// ----
.ratio {
height: 0;
text-align: center;
background: #EEE;
margin: 20px;
padding-top: 25%; // Ratio of BG image
max-width: 40%; // just for demo purposes to keep it small
position: relative;
}
.fpp {
display: inline-block;
vertical-align: middle;
position: absolute;
top: 0;
left: 0;
width: 100%;
height: 100%;
box-sizing: border-box;
}
.fpp:before {
content: '';
display: inline-block;
height: 100%;
vertical-align: middle;
}
.fpp-inner {
display: inline-block;
vertical-align: middle;
width: 98%;
background: #F5F5F5;
}
.ratio {
height: 0;
text-align: center;
background: #EEE;
margin: 20px;
padding-top: 25%;
max-width: 40%;
position: relative;
}
.fpp {
display: inline-block;
vertical-align: middle;
position: absolute;
top: 0;
left: 0;
width: 100%;
height: 100%;
box-sizing: border-box;
}
.fpp:before {
content: '';
display: inline-block;
height: 100%;
vertical-align: middle;
}
.fpp-inner {
display: inline-block;
vertical-align: middle;
width: 98%;
background: #F5F5F5;
}
<div class="ratio">
<div class="fpp">
<div class="fpp-inner">
<div class="field--name-field-fpp-text-body"> More text perhaps, was on the dockett, we could never be sure. How many words will need to fit in the box?</div>
<div class="field--name-field-fpp-text-url"> And what if there's more? What then?</div>
</div>
</div>
</div>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment