-1

not really sure if the title is well formed for my question, but it was the best i could do :)

I'm trying to create a horizontal bar with with multiple images, where all of them are oblique against the next one.. (see this image).

enter image description here

I'm not even sure if it's possible with CSS.. (and even though if it's possible when it scales up and down..)..

I want each picture in this horizontal bar clickable.. AKA : If you hover the samurai, an :hover effect applies and it's clickable (a href: )..

TylerH
  • 20,799
  • 66
  • 75
  • 101
Terje Nygård
  • 1,233
  • 6
  • 25
  • 48

1 Answers1

4

Like this?

body {
  margin:0
}

.cont {
  width:80%;
  height: 70%;
  display:flex;
  perspective:1000px;
  position: absolute;
  left: 50%;
  top: 50%;
  transform:translate(-50%,-50%);
  display:flex;
}

.cont a {
  display:block;
  height: 100%;
  flex:1;
  background-size:cover;
  transform: skew(25deg);
  position: relative;
  overflow: hidden;
}

.cont a::before {
  display: block;
  content: "";
  position: absolute;
  top: 0;
  bottom: 0;
  left: -50%;
  right: -50%;
  transform: skew(-25deg);
   background-size:cover;
   background: url("https://picsum.photos/600/700");
   position: absolute;
}

.cont a:nth-child(2)::before {
  background: url("https://picsum.photos/600/740");
}

.cont a:nth-child(3)::before  {
  background: url("https://picsum.photos/600/720");
}

.cont a:nth-child(4)::before   {
  background: url("https://picsum.photos/600/750");
}
<div class="cont">
  <a href="#"></a>
  <a href="#"></a>
  <a href="#"></a>
  <a href="#"></a>
</div>
doğukan
  • 23,073
  • 13
  • 57
  • 69