我正在尝试将我的按钮行对齐得比当前位置稍微低一些。但是,由于这是我第一次学习 html,所以我不太确定该怎么做。我可以将所有按钮对齐在一起,但我不能将按钮作为一个整体移动。
.button4 {
display: inline-center;
padding: 0.3em 1.0em;
margin: 0 0.1em 0.4em 0;
border: 0.15em solid rgba(255, 255, 255, 0);
border-radius: 3em;
box-sizing: border-box;
text-decoration: none;
font-family: 'Roboto', sans-serif;
font-weight: 300;
color: #FFFFFF;
text-shadow: 0 0.04em 0.04em rgba(0, 0, 0, 0.35);
text-align: center;
transition: all 0.2s;
}
a.button4:hover {
border-color: rgba(255, 255, 255, 1);
}
@media all and (max-width:30em) {
a.button4 {
display: block;
margin: 0.2em auto;
}
}
<div class="nav">
<div class="container">
<ul>
<a href="index.html" class="button4" style="background-color:#4e9af1">Introduction</a>
<a href="privacy.html" class="button4" style="background-color:#4e9af1">Privacy Policy & Cookies/Security</a>
<a href="security.html" class="button4" style="background-color:#4e9af1">Device Optimisation & Navigation</a>
<a href="relevant-tech.html" class="button4" style="background-color:#4e9af1">Relevant Technologies</a>
<a href="test-page.html" class="button4" style="background-color:#4e9af1">Web technologies</a>
<a href="bibliography.html" class="button4" style="background-color:#4e9af1">Bibliography</a>
</ul>
</div>
</div>
最佳答案
如果我明白你想要什么:
position:relative;
top:5px; //or whatever amount you want it to come down
别忘了“.”在 CSS 中的“button4”之前 .用于类,# 用于 ID
关于html - 尝试更改 html 中按钮的对齐方式,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/53145961/