CSS Menu layout. How to place text below Icon?

Related searches

I have a sandbox below. I have set the width of the sidebar to be fixed. I'm trying to make it so that the menu text is below the icon however the text doesn't seem to appear at all when I try to wrap it with div or span.

Would I need to have a flex container?

      <Menu.Item key="1" style={{ height: 80 }}>
      <div style={{height: 80, display: "flex", textAlign: "center"}}>
        <Icon type="pie-chart" />
        <span>Option 1</span>
        </div>
      </Menu.Item>

How can I successfully achieve below layout?

Similar is already tried and shown here below Link : How do I add Add text below font awesome icon Links? Check if solution helps to you with HTML+CSS trick

Tips for Aligning Icons to Text, Thankfully, there are a few universal tips we can put to use to ensure our icons always line up beautifully with text. Tip 1: Decide on an icon format� When all is said and done, there is a solid and simple recipe for getting icons exactly where you want to line up with text:.icon { position: relative; /* Adjust these values accordingly */ top: 5px; left: 5px; } That is the difference between icons that look in perfect alignment with text and icons that look slightly off.

<Menu.Item key="1" style={{ min-height: 80 }}>
   <div style={{min-height: 80, height: "auto", display: "flex", textAlign: "center"}}>
      <Icon type="pie-chart" style={{display: "block"}}>/>
      <span>Option 1</span>
   </div>
</Menu.Item>

Bootstrap 3 navbar with text under icons on Codeply, </div>. <div class="collapse navbar-collapse navbar-ex1-collapse">. <ul class=" nav navbar-nav">. <li class="text-center">. <a href="#" data-toggle="collapse"� Menus Icon Bar Menu Icon Accordion Tabs Vertical Tabs Tab Headers Full Page Tabs Hover Tabs Top Navigation Responsive Topnav Navbar with Icons Search Menu Search Bar Fixed Sidebar Side Navigation Responsive Sidebar Fullscreen Navigation Off-Canvas Menu Hover Sidenav Buttons Sidebar with Icons Horizontal Scroll Menu Vertical Menu Bottom

RESULT:

Change width value to something greater than 74 like 200.

How To Position Text Over an Image, Step 2) Add CSS: Example. /* Container holding the image and the text */ . container { position:� Menus Icon Bar Menu Icon Accordion Tabs Vertical Tabs Tab Headers Full Page Tabs Hover Tabs Top Navigation Responsive Topnav Navbar with Icons Search Menu Search Bar Fixed Sidebar Side Navigation Responsive Sidebar Fullscreen Navigation Off-Canvas Menu Hover Sidenav Buttons Sidebar with Icons Horizontal Scroll Menu Vertical Menu Bottom

CSS text-align-last property, To use text-align-last on only the last paragraph in the container, you can use : last child, see example below. Note: In Edge/Internet Explorer the text-align-last� Menus Icon Bar Menu Icon Accordion Tabs Vertical Tabs Tab Headers Full Page Tabs Hover Tabs Top Navigation Responsive Topnav Navbar with Icons Search Menu Search Bar Fixed Sidebar Side Navigation Responsive Sidebar Fullscreen Navigation Off-Canvas Menu Hover Sidenav Buttons Sidebar with Icons Horizontal Scroll Menu Vertical Menu Bottom

How To Create an Icon Bar, Learn how to create icon bars with CSS. display: block; /* Make the links appear below each other instead of text-align: center; /* Center-align text */ CSS Text Effects CSS Web Fonts CSS 2D Transforms CSS 3D Transforms CSS Transitions CSS Animations CSS Tooltips CSS Style Images CSS object-fit CSS Buttons CSS Pagination CSS Multiple Columns CSS User Interface CSS Variables CSS Box Sizing CSS Flexbox CSS Media Queries CSS MQ Examples CSS Responsive

The CSS3 pseudo-element::before will place the icon before the link text. In this example, the ID selector for the menu’s home link is #menu-link-1 which you can see by right-clicking the link and choosing Inspect in the browser menu.

Comments
  • Please show what you have tried
  • You can use flex-box to reach this. codesandbox.io/s/…
  • @demkovych is it possible to use class names instead of the selector like my example above?
  • I don't know ant framework.
  • @demkovych thanks dem, I will figure it out from here