html - 如何在标题中设置边距底部?
问题描述
以下代码片段显示了我希望标题在页脚中的位置。
* {
box-sizing: border-box;
}
/*HEADER*/
.header{
overflow: hidden;
height: 91px;
background-color: #000000;
width: 100%;
}
.header a {
color: #34E034;
text-decoration: none;
}
.header a.logo {
font-family: Wiz;
font-size: 55px;
font-weight: bold;
}
html, body {
margin:0;
padding:0;
}
<div class = "header">
<div class="header-row">
<div class="left-main-header">
<div class="header-box">
<div class="new-header">Techwizards</div>
<a class="logo"><b>Techwizards</b></a>
</div>
</div>
</div>
</div>
如果我现在想为标题添加字体样式。这个:
@font-face {
src: url("fonts/MagicSchoolTwo.ttf");
font-family: wiz;
}
我尝试了一切 - 边距,填充,但我没有得到底部的空间。我该如何解决?
解决方案
修复了您的代码:
你的头部有一个绝对高度。那么“a”标签默认不能有边距,你必须在显示块上设置它来渲染边距。我还按照评论中的建议在您的标题中添加了 display flex。
* {
box-sizing: border-box;
}
html,
body {
margin: 0;
padding: 0;
}
/*HEADER*/
.header {
background-color: #000000;
width: 100%;
display: flex;
}
.header a {
color: #34e034;
text-decoration: none;
}
.header a.logo {
font-family: Wiz;
font-size: 55px;
font-weight: bold;
display: block;
margin-bottom: 40px;
}
<div class="header">
<div class="header-row">
<div class="left-main-header">
<div class="header-box">
<div class="new-header">Techwizards</div>
<a class="logo"><b>Techwizards</b></a>
</div>
</div>
</div>
</div>
推荐阅读
- java - 如何将 SVG 中的 feGaussianBlur 转换为 JavaFX 中的 GaussianBlur 效果?
- google-drive-api - 如何使用来自 VK 或其他社交网络的照片 url 将照片上传到谷歌驱动器
- vector - 将数据从一个集合向量插入到另一个集合
- python - sklearn.model_selection.RandomizedSearchCV.fit 抛出的 0x7f466c02fe20> 处的 KerasRegressor 对象和 0x7f46ed175580> 处的 rv_frozen 对象是什么意思?
- laravel - 带有 Vue 3 API 调用的 Laravel sanctum
- flutter - 将服务级别缩小到更小部分的最佳方法
- r - pdftools::pdf_text 无法识别所有空格
- service - Android Location Documentation 提供了 GitHub 中 location-samples 的链接,但这些示例不适用于 SdkVersion 29
- html - 在wordpress中更改按钮悬停状态的问题
- java - 多数元素数组 Java O(nlogn)