html - 如何使用css获得这个?

标签 html css drawing

如何使用 css 绘制它?我尝试使用边框 css 并旋转 DIV,但没有找到确切的答案。

enter image description here

最佳答案

你需要使用clippath

这是示例链接 Codepen

html:

<div class="tag-blue" style="-webkit-clip-path: url(#clip1);clip-path: url(#clip1);">gadgets 3</div>

<svg width="0" height="0">
    <defs>
        <clipPath id="clip1" clipPathUnits="objectBoundingBox">
            <polygon points="0 0, 1 0, .82 1, 0 1">
            </polygon>
        </clipPath>
    </defs>
</svg>

CSS:

.tag-blue{
  background-color: red;
  height: 300px;
  width: 300px;
}

根据需要更改路径

关于html - 如何使用css获得这个?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/42241501/

相关文章:

javascript - 如何像gmail一样实现 "pop down"

javascript - 在 jquery 函数中添加延迟

javascript - 增加 SVG 元素的悬停区域

qt - 在 x,y 坐标左侧绘制

python - 如何从python 3中的url读取html

java - 如何获得小型 Java 程序的 Web 界面?

html - youtube 播放器如何缩放进度/轨迹栏?

css - 将设备方向与 3D 变换结合使用

java 3D绘图

javascript - 为图像做平滑运动的最佳方法