html - div宽度有间隙
问题描述
所以我再次写我的英雄部分,因为我想给它添加一些动画。现在我注意到有一个小的“差距”,如下图所示:
现在,有办法解决吗?我有点失落
.hero-section {
height: 100vh;
size: cover;
display: flex;
align-items: center;
justify-content: center;
}
.hero-section > .hero-content > .top-heading {
background-color: rgba(0, 188, 203, 0.7);
border-radius: 5px;
}
.hero-section > .hero-content > .bottom-heading {
background-color: rgba(0, 188, 203, 0.7);
margin-top: 10px;
border-radius: 5px;
}
<div className="hero-section" id="hero-section">
<div className="hero-content">
<div className="top-heading">
<h1>Are you looking for an apartment in Israel?</h1>
</div>
<div className="bottom-heading">
<h1>Do you need help finding a buyer or a seller?</h1>
</div>
</div>
</div>
解决方案
.hero-section {
height: 100vh;
size: cover;
display: flex;
align-items: center;
justify-content: center;
}
.hero-section > .hero-content > .top-heading {
background-color: rgba(0, 188, 203, 0.7);
border-radius: 5px;
display: inline-block;
}
.hero-section > .hero-content > .bottom-heading {
background-color: rgba(0, 188, 203, 0.7);
margin-top: 10px;
border-radius: 5px;
display: inline-block;
}
.top-heading h1, .bottom-heading h1{
display: inline;
margin: 0;
font-size: 1.9em;
}
<div class="hero-section" id="hero-section">
<div class="hero-content">
<div class="top-heading">
<h1>Are you looking for an apartment in Israel?</h1>
</div>
<div class="bottom-heading">
<h1>Do you need help finding a buyer or a seller?</h1>
</div>
</div>
</div>
推荐阅读
- dependencies - 如何包含大量依赖项
- go - 使用 NewEncoder 嵌套 JSON 流
- javascript - 如何 dom-repeat slot 内容
- vb.net - 从字符串“插入到reciptdetails(recip”到类型“integer”的转换无效)
- python - 基于索引的二维数组中的 Numpy 组合值
- r - sparklyr 公式创建错误
- javascript - 动态要求文件
- python - 密集层权重形状
- ios - UIApplication 的 `beginIgnoringInteractionEvents` 不起作用
- django - 允许用户上传个人资料图片但 1) 表单无效 2) 未正确保存