简体   繁体   English

将汉堡菜单移动到右侧 react-burger-menu

[英]Moving a burger menu to the right side react-burger-menu

I have a burger menu component using react-burger-menu component and it works fine, but I want it to move to the right side of the page and open it from the right side.我有一个使用 react-burger-menu 组件的汉堡菜单组件,它工作正常,但我希望它移动到页面的右侧并从右侧打开它。 I have tried right:0 and float:right in the CSS and tried to change the position system but either it doesn't move or the style gets ruined.我在 CSS 中尝试过 right:0 和 float:right 并尝试更改位置系统,但它要么不动,要么样式被破坏。 How can I move the exact same menu to the right?如何将完全相同的菜单向右移动?

export default props => {
  return (
  // Pass on our props
    <Menu {...props}>
      <a className='menu-item' href='/'>
          Home
      </a>

      <a className='menu-item' href='/burgers'>
          Burgers
      </a>

      <a className='menu-item' href='/pizzas'>
          Pizzas
      </a>

      <a className='menu-item' href='/desserts'>
          Desserts
      </a>
    </Menu>
  )
}

html,
body {
  margin: 0;
}

#App {
  font-family: sans-serif;
  height: 100vh;
}

#page-wrap {
  text-align: center;
  overflow: auto;
}

.bm-item {
  display: inline-block;
  text-decoration: none;
  margin-bottom: 10px;
  color: #d1d1d1;
  transition: color 0.2s;
}


.bm-item:hover {
  color: white;
}


.bm-burger-button {
  position: fixed;
  width: 36px;
  height: 30px;
  left: 36px;
  top: 36px;
  /* right: 0; */
  /* float: right; */
}


.bm-burger-bars {
  background: #373a47;
}


.bm-cross-button {
  height: 24px;
  width: 24px;
}


.bm-cross {
  background: #bdc3c7;
}


.bm-menu {
  background: #373a47;
  padding: 2.5em 1.5em 0;
  font-size: 1.15em;
}

.bm-morph-shape {
  fill: #373a47;
}


.bm-item-list {
  color: #b8b7ad;
}


.bm-overlay {
  background: rgba(0, 0, 0, 0.3);
}

and:

class HRPanel extends Component {
  render () {
    return (
      <div id='App'>
        <SideBar pageWrapId='page-wrap' outerContainerId='App' />
        <div id='page-wrap'>

        </div>
      </div>
    )
  }
}

export default HRPanel

any idea on how to fix this?关于如何解决这个问题的任何想法?

fixing style like:固定风格如:

.bm-burger-button {
  position: relative;
  width: 36px;
  height: 30px;
  right: 36px;
  top: 36px;
  /* right: 0; */
  float: right;
}

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM