html - Canvas 菜单定位

标签 html css

我为我的 Squarespace 网站设计了一个非 Canvas 菜单,我终于让目标工作了,但是我似乎无法让它从右边推出,也无法将它 float 到右边。有什么想法吗?

我正在处理的站点是:http://splitblog.squarespace.com/

HTML

<div class="side side-right">
     <div class="page-wrap">
            <div class="wrapper-right">

            <div class="main-header">
                <a href="#main-navigation" class="open-menu">☰</a>
            </div>

            <!--Main navigation.-->
              <squarespace:navigation navigationId="mainNav" template="navigation" />

            <div class="page-wrapper">
            <!--Content injection point.-->
            <section id="content" class="content">
             {squarespace.main-content}
            </section>

            </div>
         </div>
     </div>
</div>

CSS

.page-wrap {
  float: right;
  width: 100%;
  transition: width 0.3s ease;
}

.main-navigation {
  position: fixed;
  top: 0;
  width: 0;
  height: 100%;
  background: #c4c4c4;
  overflow-y: auto;
  transition: width 0.3s ease;
  z-index: 9999;

   ul {list-style: none;}

  a {
    display: block;
    color: #696969;
    background-color:#c4c4c4;
    padding: 10px;

    &:hover, &:focus {
     color:#181818;
    }
  }
}

.close-menu {
  display: none;
}

#main-navigation:target {
  width: 20%;
}
#main-navigation:target + .page-wrap {
  width: 80%;
  .open-menu {
     display: none; 
  }
  .close-menu {
     display: block;
  }
  .main-header {
    width: 80%;
    right: 20%;
  }
}

最佳答案

只需将样式 right: 0 添加到 id #main-navigation

 .main-navigation {
  position: fixed;
  /*********add here******************/
  right: 0;
  top: 0;
  width: 0;
  height: 100%;
  background: #c4c4c4;
  overflow-y: auto;
  transition: width 0.3s ease;
  z-index: 9999;

   ul {list-style: none;}

  a {
    display: block;
    color: #696969;
    background-color:#c4c4c4;
    padding: 10px;

    &:hover, &:focus {
     color:#181818;
    }
  }
}

关于html - Canvas 菜单定位,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/22432307/

相关文章:

html - emacs-org 模式和 html 发布 : how to change structure of generated HTML

javascript - 如何更改多个getElementById?

css - 如何更改uib轮播的高度宽度?

jquery - 是否可以使用 +- 按钮为金额自定义输入字段?

css - 即带有高度的背景颜色显示在整页上

html - 2个动态大小的div + float :left

php - 我无法获取发布数据以在不同页面上回显

javascript - 覆盖 tr onclick

javascript - iOS 上的双击菜单

html - 父 div 的第一个(而不是第二个)子项,取剩余宽度