我的下拉菜单是在css

时间:2016-03-22 13:59:02

标签: css drop-down-menu

我知道,我知道......在stackoverflow这里有很多关于这个主题的问题,但对于一些神秘的,上帝只知道,它没有帮助我的原因。



 {
   list-style: none;
   text-decoration: none;
   margin: 0px;
   padding: 0px;
 }
 body {
   background-image: url(../images/pozadina.jpg);
   -webkit-background-size: cover;
   -moz-background-size: cover;
   -o-background-size: cover;
   background-size: cover;
   background-size: cover;
   background-repeat: no-repeat;
   padding: 0;
   margin: 0;
 }
 #CenterRectangle {
   width: 200px;
   height: 320px;
   background: white;
   border-radius: 100px;
   position: absolute;
   top: 50%;
   left: 50%;
   margin-top: -155px;
   margin-left: -100px;
   box-shadow: 0 0 4px 5px white;
   z-index: -1;
   opacity: 0.7;
 }
 nav {
   width: 100px;
   height: 60px;
   overflow: hidden;
   margin: 210px 630px;
   text-align: center;
   color: white;
   border-radius: 20px;
   top: 50%;
   left: 50%;
 }
 nav a {
   display: block;
   color: black;
   width: 100px;
   line-height: 50px;
   background-color: #81CFE0;
   margin-top: 5px;
   text-align: center;
   border-radius: 20px;
   transition: opacity 1s;
   opacity: 0;
   position: absolute;
   z-index: 1;
 }
 nav a:first-child {
   opacity: 1
 }
 nav:hover {
   height: auto;
 }
 nav:hover a {
   opacity: 1
 }
 nav a:hover {
   background-color: #E4F1FE;
 }
 .Socialbtns {
   z-index: -1;
   margin: -10px 600px;
 }

<!DOCTYPE HTML>
<html>

<head>
  <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
  <title>Your Website!</title>
  <link rel="stylesheet" type="text/css" href="css/screen_styles.css" />
  <link rel="stylesheet" href="http://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.4.0/css/font-awesome.min.css">
</head>

<body>

  <div id="TopRectangle"></div>
  <div id="BottomRectangle"></div>
  <div id="CenterRectangle"></div>

  <div class="container">

    <nav>
      <a href="">HOME</a>
      <a href="">About Us</a>
      <a href="">Products</a>
      <a href="">Contact</a>
    </nav>
    <div class="Socialbtns">
      <i class="fa fa-cloud"></i>
    </div>

  </div>

</body>

</html>
&#13;
&#13;
&#13;

首先,如果我放置&#39; position:absolute&#39;在我的&#39; nav a&#39;然后下拉菜单很简单,它不会打开。

第二,如果我放置&#39; position:absolute&#39;在&#39; nav&#39;然后我的菜单就在右边,仍然继续推送我的内容;

我以黑云为例,以便您可以看到发生了什么。

感谢您的帮助。

0 个答案:

没有答案