如何在导航栏中修复此下拉按钮?

时间:2016-02-12 02:57:45

标签: html css navbar

这是HTML代码的开头。注意我把div"下拉"在

  • 元素中,为了将下拉按钮添加到我的固定导航栏,我在学习下拉按钮之前学习了如何创建。添加按钮的另一个问题是其他列表项上的悬停不会与导航栏的底部齐平。

    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml">
    <head>
    
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
    <link href="main.css" rel="stylesheet"/>
    <title>Vasilios Lambos</title>
    </head>
    
    <body>
    <header role="banner">
    <div id="fixed">
    <nav role="navigation">
    <ul>
        <li><a href="home.html">Home</a></li> 
        <li><a href="portfolio.html">Portfolio</a></li>
        <li>
        <div class="dropdown">
            <button class="dropbtn">Process</button>
                <div class="dropdown-content">
                <a href="#">Research</a>
                <a href="#">Exploration</a>
                <a href="#">Testing</a>
                </div>
        </div>
        </li>
        <li><a href="https://www.linkedin.com/in/vasilios-lambos-81220366">Contact</a>
    
    
    </li>
    </ul>
    </nav>
    </div>
    </header>
    
    <div class="jumbotron">
    <img src="IMG_1677.jpg" width="200" height="200"/>
    <h1>Vaslios Lambos</h1>
    <p>Industrial and Interaction Designer</p>
    <p>Always staying hungry to learn new and inspiring ways to improve my creative process. I utilize design thinking, research methods, and ethonography to explore user experience and services. Core hard skills consist of user interface design, product rendering, and testing.</p>
    
    </div>
    <div class="pics">
    <img src="VL-Logo.png" width="200" height="200"/>
    </div>
    <div class="info">
    <div class="container">
    <h3>Overview</h3>
    <p> ### </p>
    
    </div>
    
    </div>
    <div class="footer">
    <h3>Soft & Hard skills</h3>
    <ul>
        <li>Adobe Suite</li>
        <li>Axure RP</li>
        <li>HTML/CSS/Javascript</li>
    
    </ul>
    
    </div>
    
    
    </body>
    </html>
    

    下面是如何设置下拉列表样式的CSS代码,您可以在下面找到导航栏的#fixed类。

    @charset "UTF-8";
    
    @font-face {
    font-family: Verdana, Geneva, sans-serif;
    }
    body {
    font-family:Verdana, Geneva, sans-serif;
    background-color: #FFF;
    }
    *{margin:0;padding:0;}
    
    .dropbtn{
    background-color: #999;
    color:white;
    padding: 20px;
    font-size: 11px;
    font-weight:bold;
    border: none;
    cursor: pointer;
    text-transform:uppercase;
    font-family:Verdana, Geneva, sans-serif;
    z-index:-3;
    }
    .dropdown{
    position:relative;
    display: inline-block;
    }
    .dropdown-content{
    display: none;
    position: absolute;
    background-color: #f9f9f9;
    min-width: 160px;
    box-shadow: 0px 8px 16px 0px rgba(0,0,0,0.2);
    }
    .dropdown-content a{
    color:black;
    padding:12px 16px;
    text-decoration:none;
    display:block;
    }
    .dropdown-content a:hover{
    background-color:#3C6;
    }
    .dropdown:hover .dropdown-content{
    display: block;
    }
    .dropdown:hover .dropbtn{
    background-color:#3C6;
    }
    
    
    #fixed ul{
    position:fixed;
    top:0px;
    width:100%;
    z-index:9999;
    list-style-type:none;
    margin: 0;
    padding: 0;
    overflow:hidden;
    background-color: #999;
    }
    nav li{
    float:left;
    }   
      nav li a{
      display:inline-block;
      color: white;
      font-size: 11px;
      font-weight: bold;
      padding:20px;
      text-transform:uppercase;
      text-decoration:none;
     }
    
    nav a:hover {
     background-color: #3C6;
     }
    
    div.jumbotron {
    margin-top:53px;
    margin-left:auto;
    margin-right:auto;
    padding:10px;
    height:500px;
    max-width:100%;
    color:white;
    text-align:center;
    background-color:#000
    } 
    .jumbotron p{
    width:500px;
    margin-left:inherit;
    margin-right:inherit;
    }
    .jumbotron img {
    border-radius: 50%;
    margin:inherit;
    }
    
    .pics{
    /*float:right;*/
    display:inline;
    height:232px;
    width:232px;
    padding:0;
    margin:0;
    /*z-index:-1;*/
    }
    .pics img{
    padding:15px;
    border:1px solid #ccc;
    background-color: #eee;
    width:200px;
    height:200px;
    
    }
    
    div.info {
    max-width:100%;
    background-color: #000;
    color:white;
    padding:20px;
    height:400px;
    }
    div.footer{
    max-width:100%;
    background-color:#000;
    color:white;
    height:400px;
    padding:20px;
    }
    
  • 0 个答案:

    没有答案
    相关问题