2017-05-26 24 views
0

レスポンシブなナビゲーションバーは正常に作成されましたが、ドロップダウンメニューも同様に作成されましたが、divがある場合、ドロップダウンメニューは内容を知ることができますどうもありがとう。コンテンツの上にドロップダウンメニューを作成するには

HTML

<!DOCTYPE html> 
<html> 
<head> 
<title>Mac gallery</title> 
    <link rel="stylesheet" type="text/css" href="css/nav.css"> 
<link rel="stylesheet" type="text/css" href="css/stylesheet.css"> 
<link rel="stylesheet" type="text/css" href="css/gallerystyles.css"> 
<link rel="stylesheet" href="https://www.w3schools.com/w3css/4/w3.css"> 

<script src="js/nav.js"></script> 
<script src="js/javascript.js"></script> 
<script src="js/footer.js"></script> 
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1/jquery.js"></script> 
<script src="js/galleria/galleria-1.5.7.min.js"></script> 



<style> 
.galleria{ max-width: 700px; height: 400px; background: #000 } 
</style> 

<script> 
(function() { 
    Galleria.loadTheme('js/galleria/themes/classic/galleria.classic.min.js'); 
Galleria.run('.galleria'); 
}()); 
</script> 



</head> 
<body onload="time()"> 

<nav> 

    <ul class="topnav" id="myTopnav"> 

    <a href="index.html"><li>Home</li></a> 
    <div class="dropdown"> 
    <li class="dropbtn" onclick="myFunction1()">Gallerys</li> 
     <div class="dropdown-content" id="myDropdown"> 
     <a href="iphonegallery.html"><li>Iphone Gallery</li></a> 
     <a href="macgallery.html"><li>Mac Gallery</li></a> 
     <a href="ipodgallery.html"><li>Ipad Gallery</li></a> 
    </div> 
    </div> 
    <a href="contectus.html"><li>Contact US</li></a> 

    <a href="javascript:void(0);" class="icon" onclick="myFunction()"><li>&#9776;</li></a> 
    </ul> 
</nav> 

<div class="galleria"> 
<img src="img/macgallery/Imac.jpg"> 
<img src="img/macgallery/macbook.png"> 
<img src="img/macgallery/macbookpro.jpg"> 
<img src="img/macgallery/macmini.jpg"> 
</div> 











<footer> 

<p>Develop and maintain by Alastair Micallef (<span id="date"></span>)</p> 

<ul class="footernav"> 

    <a href=""><li>Home</li></a> 
    <a href=""><li>Gallery</li></a> 
    <a href=""><li>Iphone gallery</li></a> 
    <a href=""><li>Mac gallery</li></a> 
    <a href=""><li>Ipad gallery</li></a> 
    <a href=""><li>Iphone History</li></a> 
    <a href=""><li>Mac Hostory</li></a> 
    <a href=""><li>Ipod Histry</li></a> 

</ul> 


</footer> 

</body> 
</html> 

CSS

/* Add a black background color to the top navigation */ 
    .topnav { 
     background-color: #333; 
     overflow: hidden; 
    } 

    /* Style the links inside the navigation bar */ 
    .topnav a { 
     float: left; 
     display: block; 
     color: #f2f2f2; 
     text-align: center; 
     padding: 14px 16px; 
     text-decoration: none; 
     font-size: 17px; 
    } 

    /* Change the color of links on hover */ 
    .topnav a:hover { 
     background-color: #ddd; 
     color: black; 
    } 

    /* Hide the link that should open and close the topnav on small screens */ 
    .topnav .icon { 
     display: none; 
    } 

    .dropdown { 
     float: left; 
     overflow: hidden; 
     position: absolute; 
    } 

    .dropdown .dropbtn { 
     cursor: pointer; 
     font-size: 16px;  
     border: none; 
     outline: none; 
     color: white; 
     padding: 14px 16px; 
     background-color: inherit; 
     display: none; 
    } 

    .container a:hover, .dropdown:hover .dropbtn { 
     background-color: red; 
    } 

    .dropdown-content { 
     display: none; 
     position: absolute; 
     background-color: #f9f9f9; 
     min-width: 160px; 
     box-shadow: 0px 8px 16px 0px rgba(0,0,0,0.2); 
     z-index: 1; 
    } 

    .dropdown-content a { 
     float: none; 
     color: black; 
     padding: 12px 16px; 
     text-decoration: none; 
     display: block; 
     text-align: left; 
    } 

    .dropdown-content a:hover { 
     background-color: #ddd; 
    } 

    .show { 
     display: none; 
    } 





    /* When the screen is less than 600 pixels wide, hide all links, except for the first one ("Home"). Show the link that contains should open and close the topnav (.icon) */ 
    @media screen and (max-width: 600px) { 
     .topnav a:not(:first-child) {display: none;} 
     .topnav a.icon { 
     float: right; 
     display: block; 
     } 
    } 

    /* The "responsive" class is added to the topnav with JavaScript when the user clicks on the icon. This class makes the topnav look good on small screens (display the links vertically instead of horizontally) */ 
    @media screen and (max-width: 600px) { 
     .topnav.responsive {position: relative;} 
     .topnav.responsive a.icon { 
     position: absolute; 
     right: 0; 
     top: 0; 
     } 
     .topnav.responsive a { 
     float: none; 
     display: block; 
     text-align: left; 
     } 
    } 

    li{ 
     list-style: none; 
    } 

答えて

0

は、ウェブサイトにすべてのコードを置きます。提供されたコードは十分ではありません

+0

そしてコメントであるはずです – Rahul

関連する問題