IMG尺寸与角度边界

Bra*_*Box 5 html css css3

我想用一个有角度的边框分开2 img.我第一次设法调整大小.我尝试了第二次,但到目前为止我没有任何作用.到目前为止我的工作: 第二个img没有得到有角度的边框,即使我尝试将它分开制作背景看起来像这样,我希望图像与角度相匹配.

.left,
.right {
  background: #000;
  position: relative;
  height: 100px;
  width: 45%;
  float: left;
  margin-top: 10px;
  opacity: 10%;
}

.right,
.right img {
  margin-left: 0px;
  border-top-right-radius: 10px;
  border-bottom-right-radius: 10px;
}

.left,
.left img {
  border-top-left-radius: 10px;
  border-bottom-left-radius: 10px;
}

.left:after {
  content: '';
  line-height: 0;
  font-size: 0;
  width: 0;
  height: 0;
  border-top: 50px solid transparent;
  border-bottom: 100px solid #fff;
  border-left: 30px solid transparent;
  border-right: 0px solid #fff;
  position: absolute;
  top: -50px;
  right: 0;
}

.right:before,
{
  content: '';
  line-height: 0;
  font-size: 0;
  width: 0;
  height: 0;
  border-top: 100px solid #fff;
  border-bottom: 50px solid transparent;
  border-left: 0px solid transparent;
  border-right: 30px solid transparent;
  position: absolute;
  top: 0;
  left: 0;
}

.left img,
.right img {
  position: relative;
  width: 100%;
  height: 100%;
  opacity: 0.5;
}

.left img:hover,
.right img:hover {
  opacity: 1;
  cursor: pointer;
}
Run Code Online (Sandbox Code Playgroud)
<div class="left"><img src="./img/chu.jpg"></div>
<div class="right"><img src="./img/chu.jpg"></div>
Run Code Online (Sandbox Code Playgroud)

Tem*_*fif 1

您可以尝试使用clip-path

.left,
.right {
  display: inline-block;
  overflow: hidden;
  position: relative;
}

.left {
  border-radius: 10px 0 0 10px;
  -webkit-clip-path: polygon(0 0, 100% 0%, 80% 100%, 0% 100%);
  clip-path: polygon(0 0, 100% 0%, 80% 100%, 0% 100%);
}

.right {
  border-radius: 0 10px 10px 0;
  -webkit-clip-path: polygon(21% 0, 100% 0%, 100% 100%, 0% 100%);
  clip-path: polygon(21% 0, 100% 0%, 100% 100%, 0% 100%);
  margin-left: -40px;
}

img {
  display: block;
}
Run Code Online (Sandbox Code Playgroud)
<div class="left">
  <img src="https://picsum.photos/200/100?image=1069">
</div>
<div class="right">
  <img src="https://picsum.photos/200/100?image=1065">
</div>
Run Code Online (Sandbox Code Playgroud)

这是比使用倾斜变换的剪辑路径更受支持的另一个想法:

.container {
  display: inline-block;
  border-radius: 10px;
  overflow: hidden;
}

.left,
.right {
  display: inline-block;
  vertical-align:top;
  width: 200px;
  height: 100px;
  position: relative;
  transform: skew(-20deg);
  overflow: hidden;
}

.left,
.right img {
  margin-left: -20px;
}

.right {
  margin-right: -20px;
  margin-left: 5px;
}

img {
  display: block;
  transform: skew(20deg);
  width: 110%;
}
Run Code Online (Sandbox Code Playgroud)
<div class="container">
  <div class="left">
    <img src="https://picsum.photos/200/100?image=1069">
  </div>
  <div class="right">
    <img src="https://picsum.photos/200/100?image=1065">
  </div>
</div>
Run Code Online (Sandbox Code Playgroud)