下拉菜单填充/边距问题

时间:2014-01-13 03:21:20

标签: css menu margin padding

我使用了平面ui菜单的衍生物 - 但是我似乎无法消除顶部和左边距/填充 - 请帮助..这里是代码..请提供关于我如何摆脱空间的建议顶部,谢谢..

    .nav {
     margin-bottom:0;
     margin-top:0;
     padding-left:0;
     list-style:none;
 }
 .nav:before, .nav:after {
     content:" ";
     display:table;
 }
 .nav:after {
     clear:both;
 }
 .nav:before, .nav:after {
     content:" ";
     display:table;
 }
 .nav:after {
     clear:both;
 }
 .nav>li {
     position:relative;
     display:block;
 }
 .nav>li>a {
     position:relative;
     display:block;
     padding:0px 15px;
 }
 .nav>li>a:hover, .nav>li>a:focus {
     text-decoration:none;
     background-color:#198CFF;
 }
 .nav>li.disabled>a {
     color:#1abc9c;
 }
 .nav>li.disabled>a:hover, .nav>li.disabled>a:focus {
     color:#999999;
     text-decoration:none;
     background-color:transparent;
     cursor:not-allowed;
 }
 .nav .open>a, .nav .open>a:hover, .nav .open>a:focus {
     background-color:#eeeeee;
     border-color:#428bca;
 }
 /*THIS IS WHERE THE NAVBAR STARTS*/
 .navbar {
     position:relative;
     min-height:40px;
     margin:0px;
     border:0px solid transparent;
 }
 .navbar:before, .navbar:after {
     content:" ";
     display:table;
 }
 .navbar:after {
     clear:both;
 }
 .navbar:before, .navbar:after {
     content:" ";
     display:table;
 }
 .navbar:after {
     clear:both;
 }
 @media (min-width:768px) {
     .navbar {
         border-radius:4px;
     }
 }
 .navbar-header:before, .navbar-header:after {
     content:" ";
     display:table;
 }
 .navbar-header:after {
     clear:both;
 }
 .navbar-header:before, .navbar-header:after {
     content:" ";
     display:table;
 }
 .navbar-header:after {
     clear:both;
 }
 @media (min-width:768px) {
     .navbar-header {
         float:left;
     }
 }
 .navbar-collapse {
     max-height:30px;
     overflow-x:visible;
     padding-right:15px;
     padding-left:15px;
     border-top:0px solid transparent;
     box-shadow:inset 0 1px 0 rgba(255, 255, 255, 0.1);
     -webkit-overflow-scrolling:touch;
 }
 .navbar-collapse:before, .navbar-collapse:after {
     content:" ";
     display:table;
 }
 .navbar-collapse:after {
     clear:both;
 }
 .navbar-collapse:before, .navbar-collapse:after {
     content:" ";
     display:table;
 }
 .navbar-collapse:after {
     clear:both;
 }
 .navbar-collapse.in {
     overflow-y:auto;
 }
 @media (min-width:768px) {
     .navbar-collapse {
         width:auto;
         border-top:0;
         box-shadow:none;
     }
     .navbar-collapse.collapse {
         display:block !important;
         height:auto !important;
         padding-bottom:0;
         overflow:visible !important;
     }
     .navbar-collapse.in {
         overflow-y:visible;
     }
     .navbar-fixed-top .navbar-collapse, .navbar-static-top .navbar-collapse, .navbar-fixed-bottom .navbar-collapse {
         padding-left:0;
         padding-right:0;
     }
 }
 .navbar-default .navbar-nav>li>a {
     color:#777777;
 }
 .navbar-default .navbar-nav>li>a:hover, .navbar-default .navbar-nav>li>a:focus {
     color:#333333;
     background-color:transparent;
 }
 .navbar-default .navbar-nav>.active>a, .navbar-default .navbar-nav>.active>a:hover, .navbar-default .navbar-nav>.active>a:focus {
     color:#555555;
     background-color:#e7e7e7;
 }
 .navbar-default .navbar-nav>.disabled>a, .navbar-default .navbar-nav>.disabled>a:hover, .navbar-default .navbar-nav>.disabled>a:focus {
     color:#cccccc;
     background-color:transparent;
 }
 .navbar-default .navbar-toggle {
     border-color:#dddddd;
 }
 .navbar-default .navbar-toggle:hover, .navbar-default .navbar-toggle:focus {
     background-color:#dddddd;
 }
 .navbar-default .navbar-toggle .icon-bar {
     background-color:#cccccc;
 }
 .navbar-default .navbar-collapse, .navbar-default .navbar-form {
     border-color:#e7e7e7;
 }
 .navbar-default .navbar-nav>.open>a, .navbar-default .navbar-nav>.open>a:hover, .navbar-default .navbar-nav>.open>a:focus {
     background-color:#e7e7e7;
     color:#555555;
 }
 @media (max-width:767px) {
     .navbar-default .navbar-nav .open .dropdown-menu>li>a {
         color:#777777;
     }
     .navbar-default .navbar-nav .open .dropdown-menu>li>a:hover, .navbar-default .navbar-nav .open .dropdown-menu>li>a:focus {
         color:#333333;
         background-color:transparent;
     }
     .navbar-default .navbar-nav .open .dropdown-menu>.active>a, .navbar-default .navbar-nav .open .dropdown-menu>.active>a:hover, .navbar-default .navbar-nav .open .dropdown- menu>.active>a:focus {
         color:#555555;
         background-color:#e7e7e7;
     }
     .navbar-default .navbar-nav .open .dropdown-menu>.disabled>a, .navbar-default .navbar-nav .open .dropdown-menu>.disabled>a:hover, .navbar-default .navbar-nav .open .dropdown- menu>.disabled>a:focus {
         color:#cccccc;
         background-color:transparent;
     }
 }
 .navbar-default .navbar-link {
     color:#777777;
 }
 .navbar-default .navbar-link:hover {
     color:#333333;
 }
 .navbar-inverse {
     background-color:#198CFF;
     border-color:#080808;
 }
 .navbar-inverse .navbar-brand {
     color:#198CFF;
 }
 .navbar-inverse .navbar-brand:hover, .navbar-inverse .navbar-brand:focus {
     color:#ffffff;
     background-color:transparent;
 }
 .navbar-inverse .navbar-text {
     color:#999999;
 }
 .navbar-inverse .navbar-nav>li>a {
     color:#999999;
 }
 .navbar-inverse .navbar-nav>li>a:hover, .navbar-inverse .navbar-nav>li>a:focus {
     color:#ffffff;
     background-color:transparent;
 }
 .navbar-inverse .navbar-nav>.active>a, .navbar-inverse .navbar-nav>.active>a:hover, .navbar-inverse .navbar-nav>.active>a:focus {
     color:#ffffff;
     background-color:#080808;
 }
 .navbar-inverse .navbar-nav>.disabled>a, .navbar-inverse .navbar-nav>.disabled>a:hover, .navbar-inverse .navbar-nav>.disabled>a:focus {
     color:#444444;
     background-color:transparent;
 }
 .navbar-inverse .navbar-toggle {
     border-color:#333333;
 }
 .navbar-inverse .navbar-toggle:hover, .navbar-inverse .navbar-toggle:focus {
     background-color:#333333;
 }
 .navbar-inverse .navbar-toggle .icon-bar {
     background-color:#ffffff;
 }
 .navbar-inverse .navbar-collapse, .navbar-inverse .navbar-form {
     border-color:#101010;
 }
 .navbar-inverse .navbar-nav>.open>a, .navbar-inverse .navbar-nav>.open>a:hover, .navbar-inverse .navbar-nav>.open>a:focus {
     background-color:#080808;
     color:#ffffff;
 }
 @media (max-width:767px) {
     .navbar-inverse .navbar-nav .open .dropdown-menu>.dropdown-header {
         border-color:#080808;
     }
     .navbar-inverse .navbar-nav .open .dropdown-menu .divider {
         background-color:#080808;
     }
     .navbar-inverse .navbar-nav .open .dropdown-menu>li>a {
         color:#999999;
     }
     .navbar-inverse .navbar-nav .open .dropdown-menu>li>a:hover, .navbar-inverse .navbar-nav .open .dropdown-menu>li>a:focus {
         color:#ffffff;
         background-color:transparent;
     }
     .navbar-inverse .navbar-nav .open .dropdown-menu>.active>a, .navbar-inverse .navbar-nav .open .dropdown-menu>.active>a:hover, .navbar-inverse .navbar-nav .open .dropdown- menu>.active>a:focus {
         color:#ffffff;
         background-color:#080808;
     }
     .navbar-inverse .navbar-nav .open .dropdown-menu>.disabled>a, .navbar-inverse .navbar-nav .open .dropdown-menu>.disabled>a:hover, .navbar-inverse .navbar-nav .open .dropdown- menu>.disabled>a:focus {
         color:#444444;
         background-color:transparent;
     }
 }
 .navbar-inverse .navbar-link {
     color:#999999;
 }
 .navbar-inverse .navbar-link:hover {
     color:#ffffff;
 }
 .clearfix:before, .clearfix:after {
     content:" ";
     display:table;
 }
 .clearfix:after {
     clear:both;
 }
 .center-block {
     display:block;
     margin-left:auto;
     margin-right:auto;
 }
 .pull-right {
     float:right !important;
 }
 .pull-left {
     float:left !important;
 }
 .hide {
     display:none !important;
 }
 .show {
     display:block !important;
 }
 .invisible {
     visibility:hidden;
 }
 .text-hide {
     font:0/0 a;
     color:transparent;
     text-shadow:none;
     background-color:transparent;
     border:0;
 }
 .hidden {
     display:none !important;
     visibility:hidden !important;
 }
 .affix {
     position:fixed;
 }
 .navbar {
     font-size: 16px;
     border-radius: 0px;
     border: none;
 }
 .navbar .navbar-brand {
     border-radius: 1px 0 0 6px;
     color: #526476;
     font-size: 24px;
     line-height: 2900.55px;
     font-weight: 700;
     padding: 2px 28px 24px 17px;
     text-shadow: none;
     display: inline-block;
 }
 .navbar .navbar-brand:hover, .navbar .navbar-brand:focus {
     color: #1abc9c;
 }
 .navbar .navbar-brand[class*="fui-"] {
     font-weight: normal;
 }
 .navbar .navbar-brand small {
     line-height: 10;
 }
 .navbar .nav {
     margin-right: 0;
     display: inline-block;
     float: left;
 }
 .navbar .nav > li {
     position: relative;
     display: inline-block;
 }
 .navbar .nav > li:hover > ul {
     opacity: .9;
     top: 100%;
     visibility: visible;
     z-index: 100;
     -webkit-transform: scale(1, 1);
     display: block\9;
 }
 .navbar .nav > li.active > a, .navbar .nav > li.active > a:hover, .navbar .nav > li.active > a:focus {
     background: none;
     color: #4C6A89;
     -webkit-box-shadow: none;
     box-shadow: none;
 }
 .navbar .nav > li:first-child {
     border-radius: 1px 6px 0 0;
 }
 .navbar .nav > li:last-child {
     border-radius: 0 0 6px 6px;
 }
 .navbar .nav > li > ul {
     padding-top: 12px;
     top: 80%;
     padding-left: 0;
 }
 .navbar .nav > li > ul:before {
     content:"";
     border-style: solid;
     border-width: 0 9px 9px 9px;
     border-color: transparent transparent #198CFF transparent;
     height: 0;
     position: absolute;
     left: 15px;
     top: 5px;
     width: 0;
     -webkit-transform: rotate(360deg);
 }
 .navbar .nav > li > ul li:hover ul {
     opacity: .8;
     -webkit-transform: scale(1, 1);
     visibility: visible;
     display: block\9;
 }
 .navbar .nav > li > ul li ul {
     left: 100%;
 }
 .navbar .nav > li > a {
     color: #526476;
     display: inline-block;
     font-weight: 700;
     font-size: 14px;
     line-height: 200px;
     padding: 0px 20px;
     text-shadow: none;
     -webkit-transition: background-color .25s, color .25s, border-bottom-color .25s;
     transition: background-color .25s, color .25s, border-bottom-color .25s;
 }
 .navbar .nav > li > a:hover, .navbar .nav > li > a:focus {
     color: #000000;
     background-color: transparent;
 }
 .navbar .nav > li > a[class*="fui-"] {
     font-size: 24px;
     font-weight: normal;
 }
 .navbar .nav > li > a >[class*="fui-"] {
     font-size: 24px;
     margin: -4px 0 0;
     position: relative;
     top: 4px;
 }
 .navbar .nav > li > a >[class*="fui-"] + * {
     margin-left: 12px;
 }
 .navbar .nav ul {
     border-radius: 4px;
     left: 0;
     list-style-type: none;
     margin-left: 0;
     opacity: 0;
     position: absolute;
     top: 0;
     width: 234px;
     -webkit-transform: scale(1, 0.99);
     -webkit-transform-origin: 0 0;
     visibility: hidden;
     -webkit-transition: 0.25s ease-out;
     transition: 0.25s ease-out;
 }
 .navbar .nav ul ul {
     left: 95%;
     padding-left: 5px;
 }
 .navbar .nav ul li {
     background-color: #198CFF;
     padding: 0 3px 3px;
     position: relative;
 }
 .navbar .nav ul li:first-child {
     border-radius: 6px 6px 0 0;
     padding-top: 3px;
 }
 .navbar .nav ul li:last-child {
     border-radius: 0 0 6px 6px;
 }
 .navbar .nav ul li.active > a, .navbar .nav ul li.active > a:hover, .navbar .nav ul li.active > a:focus {
     background-color: #999999;
     color: #ffffff;
     padding-left: 9px;
     padding-right: 9px;
 }
 .navbar .nav ul li.active + li > a {
     padding-left: 9px;
     padding-right: 9px;
 }
 .navbar .nav ul a {
     border-radius: 2px;
     color: #ffffff;
     display: block;
     font-size: 14px;
     padding: 3px 9px;
     /*size of the menu secondary*/
     text-decoration: none;
 }
 .navbar .nav ul a:hover {
     background-color: #f1c40f;
 }
 .navbar .nav.navbar-left li:first-child a {
     border-radius: 0px 0 0 6px;
     border-left: none;
 }
 .navbar .btn-navbar {
     background: none;
     border: none;
     color: #f1c40f;
     margin: 18px 15px;
     padding: 3px 15px;
     text-shadow: none;
     display: none;
 }
 .navbar .btn-navbar:hover, .navbar .btn-navbar:focus {
     background: none;
     color: #1f1c40f;
 }
 .navbar .btn-navbar:before {
     content:"\e00c";
     font-family:"Flat-UI-Icons";
     font-size: 23px;
     font-style: normal;
     font-weight: normal;
     -webkit-font-smoothing: antialiased;
 }
 .navbar .btn-navbar .icon-bar {
     display: none;
 }
 .navbar-default {
     background: #eceef0;
     border: none;
     padding-left: 0;
     padding-right: 0;
     border-radius: 0px;
 }
 .navbar-inverse {
     background: #198CFF;
     font-size: 14px;
 }
 .navbar-inverse .navbar-brand {
     border-bottom: 2px solid #2c3e50;
     border-right: 2px solid #2c3e50;
     color: #ffffff;
     padding: 0px 28px 110px 32px;
 }
 .navbar-inverse .btn-navbar {
     color: #ffffff;
     margin: 10px 100px;
 }
 .navbar-inverse .btn-icon {
     margin: 10px 5px 10px 15px;
 }
 .navbar-inverse .nav > li:first-child.active > a {
     padding-left: 20px;
 }
 .navbar-inverse .nav > li:first-child > a {
     border-left: none;
 }
 .navbar-inverse .nav > li.active > a, .navbar-inverse .nav > li.active > a:hover, .navbar-inverse .nav > li.active > a:focus {
     background-color: #f1c40f;
     border-bottom-color: #9aa4af;
     border-left: none;
     color: #ffffff;
     padding-left: 20px;
 }
 .navbar-inverse .nav > li.active + li > a {
     border-left: none;
     padding-left: 10px;
 }
 .navbar-inverse .nav > li > a {
     font-size: 14px;
     border-bottom: 0px solid #2c3e50;
     border-left: 2px solid #2c3e50 !important;
     color: #ffffff;
     padding: 12px 20px 12px;
     line-height: 4px;
 }
 .navbar-inverse .nav.navbar-right .dropdown-menu {
     left: -100%;
     margin-left: 2px;
 }
 .navbar-inverse .nav.navbar-right .open > .dropdown-menu:before {
     display: block !important;
 }
 .navbar-inverse .nav.navbar-right > li > a {
     border-radius: 0 6px 0px 0;
 }
 .navbar-unread, .navbar-new {
     font-family:"Lato", Helvetica, Arial, sans-serif;
     background-color: #1abc9c;
     border-radius: 50%;
     color: #ffffff;
     font-size: 0;
     font-weight: 700;
     height: 61px;
     line-height: 14px;
     position: absolute;
     right: 12px;
     text-align: center;
     top: 2px;
     width: 6px;
     z-index: 10;
 }
 .active .navbar-unread, .active .navbar-new {
     background-color: #ffffff;
     display: none;
 }
 .navbar-inverse .navbar-unread, .navbar-inverse .navbar-new {
     top: 0px;
 }
 .navbar-new {
     background-color: #e74c3c;
     font-size: 12px;
     line-height: 17px;
     height: 18px;
     margin: -9px -1px;
     min-width: 18px;
     padding: 0 1px;
     width: auto;
     -webkit-font-smoothing: subpixel-antialiased;
 }
 .navbar.navbar-inverse .nav li.dropdown.open > .dropdown-toggle {
     background-color: #1abc9c;
     border-bottom-color: #16a085;
     color: #ffffff;
 }
 .navbar.navbar-inverse .nav li.dropdown.open > .dropdown-toggle .caret {
     border-bottom-color: #ffffff !important;
     border-top-color: #ffffff !important;
 }
 .navbar .nav li.dropdown.open > .dropdown-toggle {
     background: none;
     color: #1abc9c;
 }
 .navbar .nav li.dropdown.open > .dropdown-toggle .caret {
     border-bottom-color: #1abc9c !important;
     border-top-color: #1abc9c !important;
 }
 .navbar .nav li.dropdown.open .dropdown-menu {
     opacity: 1;
     top: 100%;
     visibility: visible;
     z-index: 1000;
     -webkit-transform: none;
 }
 .navbar .nav li.dropdown > .dropdown-toggle {
     outline: none;
 }
 .navbar .nav li.dropdown > .dropdown-toggle:hover .caret, .navbar .nav li.dropdown > .dropdown-toggle:focus .caret {
     border-bottom-color: #1abc9c;
     border-top-color: #1abc9c;
 }
 .navbar .nav li.dropdown > .dropdown-toggle .caret {
     border-left-width: 6px;
     border-right-width: 6px;
     border-top-width: 8px;
     border-bottom-color: #4c6a89;
     border-top-color: #4c6a89;
     margin-left: 10px;
 }
 .navbar .nav li.dropdown .dropdown-menu {
     background-color: #34495e;
     opacity: 0;
     padding: 0;
     visibility: hidden;
 }
 .navbar .nav li.dropdown .dropdown-menu:before {
     display: none;
 }
 .navbar .nav li.dropdown .dropdown-menu:after {
     border-bottom-color: #34495e;
 }
 .navbar .nav li.dropdown .dropdown-menu > li > a {
     border-radius: 3px;
     color: #ffffff;
     padding: 6px 8px 8px;
 }
 .navbar .nav li.dropdown .dropdown-menu .divider {
     background-color: #2c3e50;
     border-bottom: none;
     margin: 2px 10 5px;
     padding: 0;
     height: 2px;
 }
 .navbar.navbar-inverse .navbar-form {
     border-left: 1px solid #2c3e50;
     border-bottom: 1px solid #2c3e50;
     padding: 0px 5px 0px 2px;
 }
 .navbar.navbar-inverse .navbar-form .input-group-btn .btn {
     background-color: #2c3e50;
     color: #4c6a89 !important;
 }
 .navbar.navbar-inverse .navbar-form .form-control {
     background-color: #2c3e50;
     color: #ffffff;
 }
 .navbar.navbar-inverse .navbar-form .form-control:-moz-placeholder {
     color: #819db9;
 }
 .navbar.navbar-inverse .navbar-form .form-control::-moz-placeholder {
     color: #819db9;
 }
 .navbar.navbar-inverse .navbar-form .form-control:-ms-input-placeholder {
     color: #819db9;
 }
 .navbar.navbar-inverse .navbar-form .form-control::-webkit-input-placeholder {
     color: #819db9;
 }
 .navbar.navbar-inverse .navbar-form .form-control.placeholder {
     color: #819db9;
 }
 .navbar.navbar-inverse .navbar-form .form-control:focus {
     border-color: #1abc9c;
 }
 .navbar.navbar-inverse .navbar-form.focus .input-group-btn .btn {
     background-color: #2c3e50 !important;
 }
 .navbar .navbar-form {
     margin: 0;
     padding: 20px 5px 19px 20px;
     max-width: 229px;
 }
 .navbar .navbar-form .form-group {
     margin-bottom: 0;
 }
 .navbar .navbar-form .form-control {
     background-color: #ffffff;
     border: 2px solid transparent;
     color: #526476;
     font-size: 15px;
 }
 .navbar .navbar-form .form-control:-moz-placeholder {
     color: #798795;
 }
 .navbar .navbar-form .form-control::-moz-placeholder {
     color: #798795;
 }
 .navbar .navbar-form .form-control:-ms-input-placeholder {
     color: #798795;
 }
 .navbar .navbar-form .form-control::-webkit-input-placeholder {
     color: #798795;
 }
 .navbar .navbar-form .form-control.placeholder {
     color: #798795;
 }
 .navbar .navbar-form .form-control:focus {
     border-color: #1abc9c;
 }
 .navbar .navbar-form .input-group-btn .btn {
     border-color: transparent;
     color: #9aa4af;
     font-size: 16px;
 }
 .navbar.navbar-fixed-bottom .navbar-inner .navbar-form .form-control, .navbar.navbar-fixed-top .navbar-inner .navbar-form .form-control {
     border-radius: 0px 0 0 50px !important;
 }
 .navbar.navbar-fixed-bottom .navbar-inner .navbar-form .btn, .navbar.navbar-fixed-top .navbar-inner .navbar-form .btn {
     border-radius: 0 50px 50px 0;
 }
 .navbar.navbar-fixed-bottom .nav > li:hover > ul {
     bottom: 100%;
     padding-bottom: 1px;
     top: auto;
 }
 .navbar.navbar-fixed-bottom .nav > li:hover > ul li:hover ul {
     bottom: 0;
 }
 .navbar.navbar-fixed-bottom .nav ul {
     bottom: 100%;
     top: auto;
 }
 .navbar .navbar-inverse {
     height:0px;
     padding-top:0px;
     padding-left:0px;
     margin:0px;
 }
 .navbar-header {
     height:0px;
     padding-top:0px;
     padding-left:0px;
     margin:0px;
 }

HTML

<div class="navbar navbar-inverse">
    <div class="navbar-header">
        <button type="button" class="btn btn-navbar" 
                data-toggle="collapse"
                data-target=".navbar-collapse-01">
        </button>
    </div>
    <div class="navbar-collapse collapse navbar-collapse-01">
        <ul class="nav navbar-nav navbar-left">`enter code here`
            <li class="active"> <a href="#fakelink">Home</a>

            </li>
            <li> <a href="#fakelink">Investments</a>

                <ul>
                    <li><a href="#fakelink">Registered</a>

                    </li>
                    <li> <a href="#fakelink">Non-Registered</a>

                    </li>
                    <li><a href="#fakelink">GIC's</a>

                    </li>
                </ul>
                <!-- /Sub menu -->
            </li>
            <li> <a href="#fakelink">Articles</a>

            </li>
            <li> <a href="#fakelink">Reviews</a>

            </li>
            <li> <a href="#fakelink">Contact</a>

            </li>
            <li> <a href="#fakelink">About</a>

            </li>
        </ul>
    </div>
    <!--/.nav -->
</div>

Fiddle Demo

1 个答案:

答案 0 :(得分:0)

试试这个:

.navbar {
    position:relative;
    min-height:40px;
    margin:0px;
    /* Add padding: 0 */
    border:0px solid transparent;
}