html - 带有弹性框的三角形留下 1px 的间隙
问题描述
我在我的三角形上使用了 flex box 方向行,它在它们之间留下了 1px 的标记。请帮忙。
* {
margin: 0;
}
body {
background: #3A3335;
border: none;
}
.lightning {
display: flex;
flex-direction: row;
flex-wrap: no-wrap;
align-items: center;
justify-content: center;
margin: auto;
width: 400px;
height: 400px;
margin-top: calc((100vh - 400px) / 2);
}
.lightning .left_cont .head {
width: 0;
height: 0;
border-top: 80px solid transparent;
border-bottom: 15px solid transparent;
border-right: 60px solid #F5AB30;
}
.lightning .left_cont .tail {
width: 0;
height: 0;
border-top: 15px solid transparent;
border-bottom: 80px solid transparent;
border-right: 60px solid #F5AB30;
}
.lightning .right_cont {
margin-top: 80px;
border: none;
}
.lightning .left_cont {}
.lightning .right_cont .head {
width: 0;
height: 0;
border-top: 80px solid transparent;
border-bottom: 15px solid transparent;
border-left: 60px solid #F5AB30;
}
.lightning .right_cont .tail {
width: 0;
height: 0;
border-top: 15px solid transparent;
border-bottom: 80px solid transparent;
border-left: 60px solid #F5AB30;
}
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<title>Lighning</title>
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="stylesheet" type="text/css" media="screen" href="main.css" />
</head>
<body>
<div class="lightning">
<div class="left_cont">
<div class="head"></div>
<div class="tail"></div>
</div>
<div class="right_cont">
<div class="head"></div>
<div class="tail"></div>
</div>
</div>
</body>
</html>
我不知道该怎么办。也许错误是基于我使用三角形的事实,但我不确定。
我正在使用铬。起初它看起来不像,但是当你放大和缩小时,left_cont 和 right_cont div 之间确实有 1px 的间隙。
解决方案
推荐阅读
- python - 使用带有 python-dotenv 的 `cat` 向 env 添加凭据
- python - 在 Python 中计算数据框中的单词
- c - execve(2) 系统命令在执行前退出
- javascript - Fabricjs .toJSON() 无法正确保存到 LocalStorage ([object Object])
- javascript - 从 $arrayElemAt 结果中选择字段
- javascript - 在 JavaScript 中使用反引号(反引号)将导致“无法读取属性 'style' of null '
- tfs - 同一个 TFS 版本的两个实例能否共享一个数据层
- php - 从php中的字符串组中获取替代字符串
- r - 我可以使用 R 中的循环自动执行此代码吗?
- python - 正则表达式(re.search)无法检测错误