I have to build this website and I am faced with a unique challenge of alternating Trapezium Divs. I have never come across anything like this before and I have no idea how
You could use the SkewX transform to skew a div's before element:
div {
height: 50px;
display: inline-block;
background: lightgray;
padding: 10px;
line-height: 50px;
text-align: center;
position: relative;
transition: all 0.6s;
z-index:1;
}
div:before {
content: "";
position: absolute;
height: inherit;
background: inherit;
top: 0;
left: 30%;
height: 70px;
width: 100%;
-webkit-transform: skewX(45deg);
-moz-transform: skewX(45deg);
transform: skewX(45deg);
z-index: -1;
}
div:hover {
background: tomato;
}
Some text here
You could do this for many different trapeziums:
html,
body {
margin: 0;
padding: 0;
text-align: center;
}
body {
background: blue;
}
div {
height: 50px;
display: inline-block;
background: lightgray;
line-height: 50px;
text-align: center;
position: relative;
transition: all 0.6s;
cursor: pointer;
z-index: 1;
}
.right:before {
content: "";
position: absolute;
height: inherit;
background: inherit;
top: 0;
left: 50%;
height: 100%;
width: 100%;
-webkit-transform: skewX(45deg);
-moz-transform: skewX(45deg);
transform: skewX(45deg);
z-index: -1;
}
div:hover {
background: tomato;
}
.left {
margin-left: 50px;
}
.right {
margin-right: 50px;
}
.left:after {
content: "";
position: absolute;
height: inherit;
background: inherit;
top: 0;
left: -50%;
height: 100%;
width: 100%;
-webkit-transform: skewX(-45deg);
-moz-transform: skewX(-45deg);
transform: skewX(-45deg);
z-index: -1;
}
Some Text saying
how much I love the
MINIONS!