Skip to content

Instantly share code, notes, and snippets.

@kovchiy
Last active August 31, 2017 15:24
Show Gist options
  • Star 8 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save kovchiy/0e3fbd078429ba841c022ffa8fc86df4 to your computer and use it in GitHub Desktop.
Save kovchiy/0e3fbd078429ba841c022ffa8fc86df4 to your computer and use it in GitHub Desktop.
/*
* Блок тумбнеила
* Ширина задается числом колонок сетки (добавлением классов grid_col_1, grid_col_2...)
* Высота вычисляется согласно пропорции (_ratio), в процентах от ширины
*/
.thumb
display inline-block
background center center no-repeat
background-size cover
&:after
content ''
display block
// Проценты паддинга считаются от ширины контейнера
&_ratio
&_1x1:after
padding-bottom 100%
&_1x2:after
padding-bottom 200%
&_2x1:after
padding-bottom 50%
&_2x3:after
padding-bottom 150%
&_3x2:after
padding-bottom 66.67%
&_3x4:after
padding-bottom 133.33%
&_4x3:after
padding-bottom 75%
&_16x10:after
padding-bottom 62.5%
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment