我試圖減少 flex 容器中 (header__title-title) 和第一項 (header__title-symbol) 之間的邊距。我似乎什么都做不了。有什么建議?主軸是垂直的,因為我將 flex-direction 設定為 column
<div class="header__title">
<div class="header__title-symbol">
<span class="span-one"><hr id="hr-one" /></span>
<span id="symbol">⬙</span>
<span class="span-two"><hr id="hr-two" /></span>
</div>
<div class="header__title-title">
<h1>The Website title!</h1>
</div>
</div>
.header__title {
position: absolute;
top: 20%;
left: 50%;
transform: translate(-50%, -50%);
display: flex;
justify-content: center;
align-items: center;
flex-direction: column;
}
.header__title-title {
letter-spacing: 4px;
color: white;
font-size: 2.5rem;
text-shadow: 0 4px 4px #d19224;
animation-name: moveInLeft;
animation-duration: 1s;
font-family: "Zen Kaku Gothic Antique", sans-serif;
}
.header__title-symbol {
display: flex;
flex-direction: row;
align-items: center;
}
hr {
width: 27rem;
display: inline-block;
height: 0.3rem;
background-color: white;
}
uj5u.com熱心網友回復:
我認為你的問題不涉及到CSS彎曲性能。您可以在 CSS 檔案中添加這些行:
*, *::after, *::before {
padding: 0;
margin: 0;
-webkit-box-sizing: border-box;
box-sizing: border-box;
}
此代碼重置html檔案中所有元素的邊距和填充。然后,您可以將所需的每個邊距或填充量設定.header__title-title為適合您設計的類。例如:
.header__title-title {
padding-top: 20px;
}
uj5u.com熱心網友回復:
有多種方法可以實作這一目標。
- 將
margin-top或添加margin-bottom;到要添加空間的那些。 - 當您添加 display: flex 和 flex-direction: column 時,然后使用
justify-content: space-between;
希望這對你有用。
轉載請註明出處,本文鏈接:https://www.uj5u.com/qukuanlian/351582.html
上一篇:我如何使用GitLab睡衣?
下一篇:自動檢索物體框架外鍵關系模型
