<div id="app">
<div class="card" v-for="(item, index) in cards" :key="index" :style="{backgroundImage: 'url(' + item.img + ')'}">
<p class="card__name">
<span>{{ item.firstName }}</span>
<span>{{ item.lastName }}</span>
</p>
<p class="card__num">{{ item.num }}</p>
</div>
</div>
@import url(https://fonts.googleapis.com/css?family=Lato:400,700,900);
$lists: #5271C2 #35a541 #bdb235 #db6623 #3e5eb3 #aa9e5c;
@function longshadow($color_a,$color_b,$stepnum, $opacity: 1){
$gradient_steps: null;
@for $i from 1 through $stepnum {
$weight: ( ( $i - 1 ) / $stepnum ) * 100;
$colour_mix: mix($color_b, rgba($color_a, $opacity), $weight);
$seperator: null;
@if($i != $stepnum){
$seperator: #{','};
}
$gradient_steps: append( #{$gradient_steps}, #{$i}px #{$i}px $colour_mix $seperator );
}
@return $gradient_steps;
}
@mixin easeOut {
transition: all .6s cubic-bezier(0.23, 1, 0.32, 1);
}
* {
box-sizing: border-box;
}
body {
min-height: 100vh;
display: flex;
align-items: center;
justify-content: center;
flex-flow: column wrap;
background: lighten(black, 12);
color: white;
font-family: 'Lato';
-webkit-font-smoothing: antialiased;
text-rendering: optimizeLegibility;
padding: 20px;
background: linear-gradient(to bottom, rgba(140,122,122,1) 0%, rgba(175,135,124,1) 65%, rgba(175,135,124,1) 100%) fixed;
background: url('https://s3-us-west-2.amazonaws.com/s.cdpn.io/195612/coc-background.jpg') no-repeat center center fixed;
background-size: cover;
}
#app {
display: grid;
grid-template-columns: 30% auto 150px repeat(3, 1fr);
grid-gap: 20px;
width: 1200px;
}
.card {
height: 300px;
text-align: center;
overflow: hidden;
position: relative;
background-size: cover;
background-repeat: no-repeat;
background-position: center;
background-blend-mode: difference;
@for $i from 1 through length($lists) {
&:nth-child(#{$i}) {
background-color: nth($lists, $i);
.card__num {
text-shadow: longshadow(darken(nth($lists, $i), 10%),nth($lists, $i),5, 0.08);
}
}
}
&__name {
font-size: 30px;
font-weight: 700;
text-align: center;
span:not(:last-child) {
font-size: 14px;
display: block;
}
}
&__num {
font-size: 100px;
margin: 0 8px 0 0;
font-weight: 700;
}
p {
position: relative;
z-index: 2;
}
img {
position: absolute;
top: 50%;
left: 50%;
transform: translate(-50%, -50%);
object-fit: cover;
object-position: center;
z-index: 1;
}
}
View Compiled
new Vue({
el: '#app',
data () {
return {
cards: [
{
firstName: 'Tony',
lastName: 'Romo',
img: 'https://s3-us-west-2.amazonaws.com/s.cdpn.io/195612/barbarian.png',
num: '9'
},
{
firstName: 'Aaron',
lastName: 'Rodgers',
img: 'https://s3-us-west-2.amazonaws.com/s.cdpn.io/195612/archer.png',
num: '12'
},
{
firstName: 'Ben',
lastName: 'Roethlisberger',
img: 'https://s3-us-west-2.amazonaws.com/s.cdpn.io/195612/giant.png',
num: '7'
},
{
firstName: 'Peyton',
lastName: 'Manning',
img: 'https://s3-us-west-2.amazonaws.com/s.cdpn.io/195612/goblin.png',
num: '34'
},
{
firstName: 'Tom',
lastName: 'Brady',
img: 'https://s3-us-west-2.amazonaws.com/s.cdpn.io/195612/wizard.png',
num: '15'
},
{
firstName: 'Drew',
lastName: 'Brees',
img: 'https://s3-us-west-2.amazonaws.com/s.cdpn.io/195612/wizard.png',
num: '3'
}
]
}
}
})
This Pen doesn't use any external CSS resources.