html - 如何将导航栏移动到水平居中?

标签 html css center positioning

我想把下面的导航栏移到水平居中,但是不知道怎么办!?有什么想法吗?

ul {
  list-style-type: none;
  padding-left: 350px;
  padding-top: 30px;
}

li a {
  display: block;
  color: #ffffff;
  padding: 10px 15px 10px 15px;
  text-decoration: none;
  font-size: 15px;
  border-left: 1px solid #FEDD19;
  float: left;
}

li a:hover {
  color: #000000;
  background-color: #FEDD19;
}

最佳答案

#nav ul {
    display: inline-block;
    list-style-type: none;
}

How to center a navigation bar with CSS or HTML?

关于html - 如何将导航栏移动到水平居中?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/39960213/

相关文章:

html - 如何创建一个 DIV,它在 :hover (for desktop) and on tap (for touch devices) using CSS? 上下拉另一个 DIV

css - 在响应式站点中将绝对定位框居中

css - 为什么我的导航栏不是我当前代码的浏览器的整个宽度?

css - Bootstrap navbar-brand 标题在 navbar-nav 上方——怎么样?

html - 为什么margin :0 auto; not work on this input button?

html - 下拉菜单消失并且不能居中按钮

css - 将鼠标悬停在多个并发 DIV 上

javascript - Jquery MouseOver 事件 - child 不可见

javascript - Jquery关于属性操作的问题

css - 覆盖 PrimeNG 步骤组件样式