簡體   English   中英

使子菜單在頁腳上方滑動

[英]make sub menu slide above footer

如何使產品中的子菜單滑動到頁腳上方而不是上方? 這樣我就可以制作一個具有不同高度的子菜單,而無需在側面頁腳之外放置子菜單。.這就像我需要的演示一樣。

http://jsfiddle.net/zzd73ckz/

    <div id='cssmenu'>
    <ul>
       <li><a href='#'><span>Home</span></a></li>
       <li class='active has-sub'><a href='#'><span>Products</span></a>
          <ul>
             <li class='has-sub'><a href='#'><span>Product 1</span></a>
                <ul>
                   <li><a href='#'><span>Sub Product</span></a></li>
                   <li class='last'><a href='#'><span>Sub Product</span></a></li>
                </ul>
             </li>
             <li class='has-sub'><a href='#'><span>Product 2</span></a>
             </li>
              <li class='has-sub'><a href='#'><span>Product 2</span></a>
             </li>
              <li class='has-sub'><a href='#'><span>Product 2</span></a>
             </li>
              <li class='has-sub'><a href='#'><span>Product 2</span></a>
             </li>
    </ul>
    </div>
    <div class="footer">
        <a href='www.google.com'>search in google </a>
    </div>

    @charset "UTF-8";
    /* Some stylesheet reset */
#cssmenu > ul {
  list-style: none;
  margin: 0;
  padding: 0;
  vertical-align: baseline;
  line-height: 1;
}
/* The container */
#cssmenu > ul {
  display: block;
  position: relative;
  width: 150px;
}
/* The list elements which contain the links */
#cssmenu > ul li {
  display: block;
  position: relative;
  margin: 0;
  padding: 0;
  width: 100%;
}
/* General link styling */
#cssmenu > ul li a {
  /* Layout */

  display: block;
  position: relative;
  margin: 0;
  border-top: 1px dotted #fff;
  border-bottom: 1px dotted #d9d9d9;
  padding: 11px 20px;
  /* Typography */

  font-family: Helvetica, Arial, sans-serif;
  color: #e4433c;
  text-decoration: none;
  text-transform: uppercase;
  text-shadow: 0 1px 0 #fff;
  font-size: 13px;
  font-weight: 300;
  /* Background & effects */

  background: #eaeaea;
}
/* Rounded corners for the first link of the menu/submenus */
#cssmenu > ul li:first-child > a {
  border-top-left-radius: 4px;
  border-top-right-radius: 4px;
  border-top: 0;
}
/* Rounded corners for the last link of the menu/submenus */
#cssmenu > ul li:last-child > a {
  border-bottom-left-radius: 4px;
  border-bottom-right-radius: 4px;
  border-bottom: 0;
}
/* The hover state of the menu/submenu links */
#cssmenu > ul li a:hover,
#cssmenu > ul li:hover > a {
  color: #ffffff;
  text-shadow: 0 1px 0 rgba(0, 0, 0, 0.25);
  background: #f23f37;
  background: -webkit-linear-gradient(#f23f37, #e7180f);
  background: -moz-linear-gradient(#f23f37, #e7180f);
  background: linear-gradient(#f23f37, #e7180f);
  border-color: transparent;
}
/* The arrow indicating a submenu */
#cssmenu > ul .has-sub > a::after {
  content: "";
  position: absolute;
  top: 16px;
  right: 10px;
  width: 0px;
  height: 0px;
  /* Creating the arrow using borders */

  border: 4px solid transparent;
  border-left: 4px solid #e4433c;
}
/* The same arrow, but with a darker color, to create the shadow effect */
#cssmenu > ul .has-sub > a::before {
  content: "";
  position: absolute;
  top: 17px;
  right: 10px;
  width: 0px;
  height: 0px;
  /* Creating the arrow using borders */

  border: 4px solid transparent;
  border-left: 4px solid #fff;
}
/* Changing the color of the arrow on hover */
#cssmenu > ul li > a:hover::after,
#cssmenu > ul li:hover > a::after {
  border-left: 4px solid #fff;
}
#cssmenu > ul li > a:hover::before,
#cssmenu > ul li:hover > a::before {
  border-left: 4px solid rgba(0, 0, 0, 0.25);
}
/* THE SUBMENUS */
#cssmenu > ul ul {
  position: absolute;
  left: 100%;
  top: -9999px;
  padding-left: 5px;
  opacity: 0;
  width: 150px;
  /* The fade effect, created using an opacity transition */

  -webkit-transition: opacity 0.3s ease-in;
  -moz-transition: opacity 0.3s ease-in;
  transition: opacity 0.3s ease-in;
}
#cssmenu > ul ul li a {
  font-size: 12px;
}
/* Showing the submenu when the user is hovering the parent link */
#cssmenu > ul li:hover > ul {
  top: 0px;
  opacity: 1;
  z-index: 1;
}
.footer{
    margin-top:100px;
    background-color:black;
    height:38px;
    width:925px;
    text-align:center;
}
.footer a{
    text-decoration:none;
    font:bold 16px arial;
    color:white;
    line-height: 40px;
    text-align:center;
}

如果我正確理解了您的問題,您要做的就是像這樣增加頁腳的上邊距

.footer{
    margin-top:100%;
    background-color:black;
    height:38px;
    width:925px;
    text-align:center;
}

這會將頁腳推到頁面底部

的jsfiddle

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM