Monday, May 20, 2024
 Popular · Latest · Hot · Upcoming
80
rated 0 times [  81] [ 1]  / answers: 1 / hits: 18855  / 6 Years ago, tue, january 16, 2018, 12:00:00

Good afternoon. I'm new to web development and I'm not able to put the ant design menu (https://ant.design/components/menu/) at 100% of the screen height.



I tried to put <Layout style = {{height: 100vh }}> before the but it did not work.



Here's the code I'm using



.
.
.
.
.



import React from 'react'
import { Layout, Menu, Breadcrumb, Icon, Button } from 'antd';

const { Header, Content, Footer, Sider } = Layout;
const SubMenu = Menu.SubMenu;

export class SideMenu extends React.Component {

constructor(props){
super(props)
this.state = {collapsed: false}
}

toggleCollapsed (){
this.setState({
collapsed: !this.state.collapsed
})
}

render() {
return (
<div style={{ width: 256 }}>
<Menu
defaultSelectedKeys={[]}
defaultOpenKeys={[]}
mode=inline
theme=light
inlineCollapsed={this.state.collapsed}
>
<Menu.Item key=0>
<div onClick={this.toggleCollapsed.bind(this)}>
<Icon type={this.state.collapsed ? 'menu-unfold' : 'menufold'}/>
</div>
</Menu.Item>
...
<Menu.Item key=5>
<Icon type=rocket />
<span>Funções</span>
</Menu.Item>
</Menu>
</div>
);
}
}


Thanks for your help.


More From » html

 Answers
8

Try to manage separate style sheet(in my case menu.less) and put it this code



it should be work



.menu-style {

height: 100vh;
width: 200px;
position: fixed;
}


just try it.


[#55444] Friday, January 12, 2018, 7 Years  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
jazminuniquer

Total Points: 63
Total Questions: 121
Total Answers: 96

Location: Cambodia
Member since Thu, May 21, 2020
4 Years ago
;