<div class="ratio_image ratio_image_1x1">
<img src="http://lorempixel.com/500/500/" alt="">
</div>
<div class="ratio_image ratio_image_1x2">
<img src="http://lorempixel.com/500/500/" alt="">
</div>
<div class="ratio_image ratio_image_2x1">
<img src="http://lorempixel.com/500/500/" alt="">
</div>
<div class="ratio_image ratio_image_2x2">
<img src="http://lorempixel.com/500/500/" alt="">
</div>
.ratio_image {
width: 300px;
height: 300px;
float: left;
margin: 20px;
position: relative;
overflow: hidden;
}
.ratio_image:before {
width: 100%;
display: block;
content: "";
}
.ratio_image img {
min-width: 100%;
min-height: 100%;
position: absolute;
top: 0;
left: 0;
}
.ratio_image_2x1 {
width: 600px;
}
.ratio_image_1x2,
.ratio_image_2x2 {
height: 600px;
}
.ratio_image img {
width: 100%;
}
.ratio_image_1x1:before {
padding-top: 100%; /* (300 / 300) * 100%; */
}
.ratio_image_2x1:before {
padding-top: 200%; /* (600 / 300) * 100%; */
}
.ratio_image_1x2:before {
padding-top: 50%; /* (300 / 600) * 100%; */
}
.ratio_image_2x2:before {
padding-top: 100%; /* (600 / 600) * 100%; */
}
$(window).scroll(function() {
if ($(window).scrollTop() > 1 && $(window).scrollTop() < 815){
$('html,body').stop().animate({ 'scrollTop': 815 }, 'fast');
});
});
<a class="b"><span class="b__i">Lorem ipsum</span></a>
<a class="b"><span class="b__i">Lorem ipsum dolor sit amet, consectetur adipisicing elit.</span></a>
<a class="b"><span class="b__i">Lorem ipsum dolor sit amet</span></a>
.b {
max-width: 200px;
height: 50px;
padding: 0 20px;
font-size: 0;
line-height: 50px;
text-decoration: none;
display: inline-block;
vertical-align: top;
}
.b__i {
font-size: 13px;
display: inline-block;
vertical-align: middle;
line-height: 1;
}
{compress
mode = 'css'
media = 'screen'
type = 'inline'
source = [
[ 'file' => 'http://fonts.googleapis.com/css?family=Titillium+Web:300|Exo+2:300,400,700&subset=latin,cyrillic' ],
[ 'file' => 'http://fonts.googleapis.com/css?family=Six+Caps' ],
[ 'file' => '/css/screen.css' ]
]
}
{compress
attr = 'data-no-instant async' // если нужны атрибуты какие то
mode = 'js'
type = 'inline' // Это если вы хотите что бы скрипт был в контенте, для уменьшения количества запросов
source = [
[ 'file' => '/js/jquery.js' ],
[ 'file' => '/js/app.js' ]
]
}