From: stephen@cubedesigners.com Date: Thu, 7 Jul 2016 16:40:48 +0000 (+0000) Subject: Image preparation and styling. Refactor CSS to use inline `'; + + return $res; + } + + protected function _backgroundColour($block) { + if (empty($block['background_gradient']['color1'])) { + return ''; + } + + return 'background-color: '. $block['background_gradient']['color1'] .';'; + } + + protected function _backgroundImage($block) { + if (!is_array($block['background_image'])) return ''; + + $path = CubeIT_View_Helper_ImageCms::getPath($block['background_image']); + + return "background-image: url('$path');"; + } + + protected function _gradient($block) { + + $gradient = $block['background_gradient']; - protected function _gradient($gradient) { if (empty($gradient['color1']) || empty($gradient['color2'])) { - return false; + return ''; } $angle = '45deg'; diff --git a/less/410-features.less b/less/410-features.less index ba6def8..4959a3e 100644 --- a/less/410-features.less +++ b/less/410-features.less @@ -7,16 +7,28 @@ .feature-block { position: relative; overflow: hidden; + background-repeat: no-repeat; + background-size: 100%; // Block layouts &.rectangle-right, &.rectangle-bottom { width: percentage(3/6); padding-bottom: percentage(2/6); // 3:2 aspect ratio } + &.rectangle-right { + background-position: center right; + } + &.rectangle-bottom, &.square-bottom { + background-position: center bottom; + } + &.square-top, &.square-bottom { width: percentage(2/6); padding-bottom: percentage(2/6); // 1:1 aspect ratio } + &.square-top { + background-position: center top; + } &.small-rectangle-tall { width: percentage(1/6); @@ -52,7 +64,7 @@ .square-top & { margin-top: 50%; - + padding-top: 30px; } }