user12465675
user12465675

Reputation:

React js Semantic Menu items on center

Hello I am having trouble leaving my content at the center of this div

code : https://codesandbox.io/s/hungry-https-c5432

I tried to put the inline display on h5 and it still didn't work

<div className="App">
  <Menu
    className="borderless"
    style={{ width: "240px", height: "100vh" }}
    vertical
  >
    <Menu.Item className="logo">
      <Image src={logo} style={{ width: "50px", height: "50px" }} />
      <h5>E M A S A</h5>
      <Divider style={{ color: "#000 !important" }} />
    </Menu.Item>
  </Menu>
</div>

css:

.ui.menu {
  border-radius: 0px !important;
  border: 0px !important;
  box-shadow: none !important;
  background-color: #252631 !important;
}
.ui.menu .item {
  padding: 8px !important;
}
r {
  margin-bottom: 0 !important;
}r {
  margin-bottom: 0 !important;
}

Upvotes: 2

Views: 1053

Answers (3)

ankitkanojia
ankitkanojia

Reputation: 3122

You need to update CSS, Here is the demo link

JSX Code

 <Menu
    className="borderless"
    style={{ width: "240px", height: "100vh" }}
    vertical>
    <Menu.Item className="logo">
      <h5>
        <Image
          src={logo}
          style={{ width: "50px", height: "50px", marginRight: "10px" }}
        />
        <span>E M A S A</span>
      </h5>
      <Divider style={{ color: "#000 !important" }} />
    </Menu.Item>
  </Menu>

CSS

.ui.menu {
  border-radius: 0px !important;
  border: 0px !important;
  box-shadow: none !important;
  background-color: #252631 !important;
}

.ui.menu .item {
  padding: 8px !important;
  text-align: center;
}

.ui.menu .item h5 {
  text-align: center;
}

.ui.divider {
  margin-bottom: 0 !important;
}

img.ui.image {
  display: inline-block;
}

Upvotes: 0

Arpit Bhatia
Arpit Bhatia

Reputation: 173

In order to align the img to center you can add margin: 0 auto; display: block;

and for aligning the text h5 you can add text-align: center;

Check this link: https://codesandbox.io/embed/sweet-glitter-9toif?fontsize=14&hidenavigation=1&theme=dark

Upvotes: 2

godfather
godfather

Reputation: 1563

i understood you need them on the same line so add this to the css .ui.vertical.menu .item{display:flex; justify-content:center;}

Upvotes: 1

Related Questions