html - 导航栏不是全宽 - 没有 Bootstrap

标签 html css

我故意不使用 Bootstrap。我有一个问题应该很容易解决,但我似乎无法解决。我所需要的只是让我的导航栏适合浏览器的顶部,现在它停在边缘附近。

View :

    <div class="nav">
  <ul>
    <li><%= link_to 'Subscribers', subscribers_path %></li>
    <li><%= link_to 'Sign Up', new_subscriber_path %></li>
    <li><%= link_to 'Check In', subscribers_search_path %></li>
  </ul>
</div>

CSS:

    .nav {
  width: 100%;
}

ul {
    list-style-type: none;
    margin: 0;
    padding: 0;
    overflow: hidden;
    background-color: #333;
}

li {
    float: left;
    border-right:1px solid #bbb;
}

li:last-child {
    border-right: none;
}

li a {
    display: block;
    color: white;
    text-align: center;
    padding: 14px 16px;
    text-decoration: none;
}

li a:hover:not(.active) {
    background-color: #111;
}

.active {
    background-color: #4CAF50;
}

导航栏:

enter image description here

如果仔细观察,您会发现该条没有到达屏幕的 Angular 落。任何帮助都会非常感谢!

最佳答案

只需添加:

body{
  margin:0px;
  padding:0px;  
}

关于html - 导航栏不是全宽 - 没有 Bootstrap ,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/37982194/

相关文章:

css - 将媒体查询放入mixin

javascript - JS : Slideshow inaccurate result

html - 复选框按钮需要多次点击

javascript - 当select有值时在select by text中选择值?

html - 左边是表格,右边是图片的列没有响应

jquery - Bootstrap 在导航下方显示搜索栏

jquery - 如何创建没有 SCSS /暂停的循环幻灯片

html - 为什么高度百分比会将相邻的 div 缩小到相同的高度?

html - 直接在主体之后的 div 仅在 Firefox 中导致较大的顶部边距

html - 如何制作一个具有两个屏幕大小的 div 的可滚动 flexbox?