首页 > 解决方案 > 如何使div右上角裁剪

问题描述

我想做DIV如下图:

在此处输入图像描述

请有人帮我实现这一目标

.div {
  height: 200px;
  background: blue;
  border-radius: 4px;
  border-top-right-radius: 40px;
}
<div class="div"></div>

注意:div 背景应该是白色的

标签: htmlcss

解决方案


.tag-wrap {
  height: 200px;
  width: 500px;
  background: #f7f7f7;
  border-radius: 4px;
  border-top-right-radius: 0;
  border-left:10px solid blue;
  border-top-left-radius: 10px;
  border-bottom-left-radius: 10px;
  filter: drop-shadow(3px 3px 3px rgba(50, 50, 0, 0.3));
}
.tag {
  background: #fff;
  height: 200px;
  clip-path: polygon(0% 0%, 90% 0, 100% 30%, 100% 100%, 0% 100%);
}
<!DOCTYPE html>
<html>
<head>
  <meta charset="utf-8">
  <meta name="viewport" content="width=device-width">
  <title>JS Bin</title>
</head>
<body>
<div class="tag-wrap">
  <div class="tag">
  </div>
</div>
</body>
</html>

我已经用过clip-path这个了。您可以使用以下链接生成剪辑路径!

仅供参考clip pathbox-shadow不要一起工作,所以你必须遵守一些规则。这是参考链接 https://css-tricks.com/using-box-shadows-and-clip-path-together/


推荐阅读