php - 导航栏上的下拉菜单。 -下拉按钮与其余导航按钮不对齐。 HTML

标签 php jquery html css

如您所见,我注释掉了下拉菜单的代码,菜单有效。但它与导航栏的其余部分不对齐。感谢您的帮助。

    <div id="top_nav">
        <div id="top_nav_container">
          <ul>
            <li><a href="index.php">Home</a></li>
            <li><a href="redacted.php">Redacted</a></li>
            <li><a href="how_it_works.php">How It Works</a></li>
            <li><a href="faqs.php">FAQs</a></li>
            <li><a href="special_offers.php">Special Offers</a></li>
            <li><a href="customer_service.php">Customer Service</a></li>
          <!-- <span class="dropdown">
               <span class="dropbtn">Special Offers</span>
               <span class="dropdown-content">
                   <a href="#">Link 1</a>
                   <a href="#">Link 2</a>
                   <a href="#">Link 3</a>
               </span>  -->
          </ul>
        </div>

这是 CSS - 原来的是靠近底部的(在“cont.”之后,顶部是后来从外部源添加的)

/* TOP NAV */
/* dd

/* Style The Dropdown Button */
.dropbtn {
    background-color: #5d72b3;
    color: white;
    margin:auto;
    padding: 0px;
    text-align:center;
    font-size: 14px;
    border: none;
    cursor: pointer;
    text-decoration:none;
    border-right:1px solid #FFF;
    padding:9px 12px 0 12px;
}

/* The container <div> - needed to position the dropdown content */
.dropdown {
    position: relative;
    display: inline-block;
}

/* Dropdown Content (Hidden by Default) */
.dropdown-content {
    display: none;
    position: absolute;
    background-color: #f9f9f9;
    min-width: 160px;
    box-shadow: 0px 8px 16px 0px rgba(0,0,0,0.2);
}

/* Links inside the dropdown */
.dropdown-content a {
    color: black;
    padding: 12px 16px;
    text-decoration: none;
    display: block;
}

/* Change color of dropdown links on hover */
.dropdown-content a:hover {background-color: #f1f1f1}

/* Show the dropdown menu on hover */
.dropdown:hover .dropdown-content {
    display: block;
}

/* Change the background color of the dropdown button when the dropdown content is shown */
.dropdown:hover .dropbtn {
    background-color: #3e8e41;
}


/*________________________cont. */
#top_nav_container {
    position:relative;
    width:1000px;
    margin:auto;
    height:33px;
}
#top_nav {
    width:1000px;
    height:33px;
    background-color:#5d72b3;
    border-bottom:1px solid #FFF;
    border-top:1px solid #FFF;
    margin:auto;
}
#top_nav ul {
    width:849px;
    margin:0;
    padding:0;
    list-style:none;
}
#top_nav ul li {float: left;}
#top_nav ul li a {
    display:block;
    width:auto;
    height:24px;
    text-align:center;
    font-size:14px;
    font-family:Arial, Helvetica, sans-serif;
    color:#FFF;
    text-decoration:none;
    border-right:1px solid #FFF;
    padding:9px 12px 0 12px;
}
#top_nav ul li a:hover {
    background-color:#86a3ff;
}
#sub_nav_bar {
    width:1000px;
    height:40px;
    margin:0 auto 6px auto;
    text-align:center;
}

已编辑的公司信息 djdjsjshsjshhshshshshshshshhshshshshshshshshshhshshs Sjshshsjs 嘘嘘嘘嘘嘘嘘jsjsjsjhshss

最佳答案

.dropbtn { display: block;
height: 24px; }

关于php - 导航栏上的下拉菜单。 -下拉按钮与其余导航按钮不对齐。 HTML,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/35310341/

相关文章:

PHPUnit 因 Symfony2 session 而失败

php - Bootstrap 表延伸到容器之外

php - 将多个文本框中的值与 mysql 表进行比较

javascript - 如何在几个课前选择文本

jquery - 如何使用 jQuery 迭代 gridview 或 listview?

javascript - 如何使用按钮允许用户添加/减去输入元素并保持元素值顺序?

html - 发布 JSON 与传统表单编码数据作为提交表单的数据格式

javascript - POST 到 PHP 弹出窗口的可点击 HTML 表格行

php - Json_encode、json_decode 和 UTF8

javascript - 使用 Javascript 和 JQuery 对 svg 元素进行动画处理