html - 尝试更改 html 中按钮的对齐方式

标签 html css

我正在尝试将我的按钮行对齐得比当前位置稍微低一些。但是,由于这是我第一次学习 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/

相关文章:

JQuery toggleClass 和 slideToggle - toggleClass 的行为不正确

html - 播放存储为 blob 的 MP3 文件

html - 增加列表项之间的分隔符长度

html - 为什么我的图像调整大小不可预测?

css - 允许 SVG 图形溢出到包含的 svg 元素之外

javascript - 灯箱缩略图问题 : header width becoming extended when viewing image

html - 查看<h1></h1>内的所有链接,需要对其设置样式,使链接变小

html - 使用 CSS 到 'pop-out' div 列表中的一个 div

css - 如何在不覆盖 CSS 的情况下将 XHTML 页面包含在另一个 XHTML 中

css - Bootstrap v3.3.1 中的超链接在 xs 屏幕上不起作用