[英]Add space between HTML elements such as H4 only using CSS
您可以使用<br>
HTML 標記或在 CSS 中添加margin
,如下所示:
h4 {
margin: 10px;
}
你可以使用彈性盒! 這只適用於 h4 元素在頁腳中的情況
footer{
display:flex;
flex-direction:row;
justify-content: space-between;
}
你也可以說 space-around 而不是 space-between。 這將在第一個 h4 的左側和最后一個 h4 的右側添加空間。
footer{ display:flex; flex-direction:row; justify-content: space-between; } footer h4{ position: relative; display: inline; font-family: sans-serif; }
<footer> <h4>I FORGOT</h4> <h4>WHAT THE </h4> <h4>WORDS WERE</h4> </footer>
嘗試
footer h4 {
margin-right: 30%;
}
或者
footer h4 {
display: inline-block;
width: 33%;
text-align: center;
}
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.