javascript - 如何在 html、css、react 中制作带有内部文本的箭头?
解决方案
我敢肯定还有一百多种方法。这是其中之一:
div {
width: 100px;
height: 40px;
position: relative;
background: green;
display: flex;
justify-content: center;
align-items: center;
color: white;
}
div:before {
content: "";
position: absolute;
right: -20px;
bottom: 0;
width: 0;
height: 0;
border-left: 20px solid green;
border-top: 20px solid transparent;
border-bottom: 20px solid transparent;
}
<div>4.7</div>
推荐阅读
- javascript - 我可以让这个双重功能更简洁吗?
- javascript - 关闭复选框不适用于 chrome 扩展?
- android - 对齐 2 个视图底部,但一个被推得更低
- magento - 您如何在 Magento 网站上 301 重定向 404 错误?
- javascript - 在形状路径上写入文本
- java - 将 TextFlow 添加到 FXML 控制器会使 GUI 变为空白
- python - 没有 distutils.version 的 Python 版本列表
- c# - 调用 System.Diagnostics.Process.GetProcesses() 未返回 C# 最小化窗口
- xcode - 有什么方法可以从终端为 Xcode 添加新的启动图像
- docker - 使用主机库的 Docker