html - Div 之间的奇怪边距
问题描述
我在代码中遇到了一些奇怪的行为。我正在尝试用 flexbox 放置一排 div。这是一个片段:
html{
width: 100%;
height:100%;
background:black;
font-family: Impact;
margin: 0px;}
.columns{
display:flex;
justify-content: center;
}
.col-1{
display:flex;
align-items: center;
justify-content: center;
width:50%;
background: green;
color: white;
height: 25vh;
font-size: calc(5vw + 5vh + 2.5vmin);
min-width: 200px;
min-height:100px;
}
.col-2{
display:flex;
align-items: center;
justify-content: center;
width:50%;
color:white;
background: red;
height:25vh;
font-size: calc(5vw + 5vh + 2.5vmin);
min-width: 200px;
min-height:100px;
}
.score-1 {
display:flex;
align-items:center;
justify-content: center;
color:black;
background:white;
height:40vh;
margin-left:9vw;
margin-top:3vh;
width:30%;
min-width: 200px;
min-height:100px;
font-size:calc(12vw + 12vh + 2.5vmin);
}
.clock {
display:flex;
align-items:center;
justify-content: center;
margin-top:5vh;
height:25vh;
vertical-align:middle;
font-size: calc(8vw + 8vh + 2.5vmin);
background:white;
color:cadetblue;
}
.score-2 {
display:flex;
align-items:center;
justify-content: center;
color:black;
background:white;
height:40vh;
margin-right:9vw;
margin-top:3vh;
width:30%;
min-width: 200px;
min-height:100px;
font-size:calc(12vw + 12vh + 2.5vmin);
}
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<link rel="stylesheet" href="styles.css">
<title>Skore</title>
</head>
<body>
<div class=columns>
<div class="col col-1"> SOLDATOVA </div>
<div class="col col-2"> DROR Y B </div>
</div>
<div class=columns>
<div class="col country-1"> 45 </div>
<div class="col country-2"> 0 </div>
</div>
<div class=columns>
<div class="score-1">45</div>
<div class="clock">3:00</div><
<div class="score-2">0</div>
</div>
</body>
</html>
clock
和之间有一个差距score-2
,但是 columns
我正在使用的属性justify-content: center;
,所以我认为它内部的 div 之间没有边距,所以我不确定这里发生了什么。有什么办法解决吗?
解决方案
推荐阅读
- java - 尝试使用 ElasticSearch 存储和获取一些数据
- dataweave - JSON 对象忽略 null
- c# - 实现自定义两因素身份验证,为什么 GetTwoFactorAuthenticationUserAsync() 返回一个空用户?
- c++ - 从负 int 静态转换为 uint
- c++ - C ++指针的指针是否自动访问新值?
- asp.net-core - 如何在 Asp .Net Core SignalR Hub 中获取不记名令牌?
- reactjs - 如何从 react-scripts 中删除未使用的依赖项?
- ansible - 在一组主机上运行 ansible 任务,每个主机也作为参数传递给任务
- firebase - Firebase Auth SendEmailVerificationAsync 在收件人电子邮件上失败
- c# - CS0311 受约束的泛型方法没有隐式引用转换