Center Menu

You can align the Menu items to center by setting “EnableCenterAlign” property as true. “EnableCenterAlign” property accepts Boolean value. By default, its value is false. When set to true, then the root menu items is aligned in center.

  1. Add the following code in your view section.
  • cshtml
  • // Add the following code in CSHTML section.
    
    <ej-menu id="menu" width="100%" enable-center-align="true">
        <e-menu-items>
            <e-menu-item url="" text="File">
                <e-menu-child-items>
                    <e-menu-child-item text="New" url=""></e-menu-child-item>
                    <e-menu-child-item text="Open" url=""></e-menu-child-item>
                    <e-menu-child-item text="Save" url=""></e-menu-child-item>
                    <e-menu-child-item text="PrintPreview" url=""></e-menu-child-item>
                    <e-menu-child-item text="Print" url=""></e-menu-child-item>
                </e-menu-child-items>
            </e-menu-item>
            <e-menu-item text="Edit" url="">
                <e-menu-child-items>
                    <e-menu-child-item text="Undo" url=""></e-menu-child-item>
                    <e-menu-child-item text="Redo" url=""></e-menu-child-item>
                    <e-menu-child-item text="Mobile MVC" url=""></e-menu-child-item>
                    <e-menu-child-item text="Services" url=""></e-menu-child-item>
                </e-menu-child-items>
            </e-menu-item>
            <e-menu-item text="View" url="">
                <e-menu-child-items>
                    <e-menu-child-item text="Print Layout" url=""></e-menu-child-item>
                    <e-menu-child-item text="Show ruler" url=""></e-menu-child-item>
                    <e-menu-child-item text="Show spelling suggestion" url=""></e-menu-child-item>
                    <e-menu-child-item text="Compact controls" url=""></e-menu-child-item>
                    <e-menu-child-item text="Full screen" url=""></e-menu-child-item>
                </e-menu-child-items>
            </e-menu-item>
            <e-menu-item text="Insert" url="">
                <e-menu-child-items>
                    <e-menu-child-item text="Image" url=""></e-menu-child-item>
                    <e-menu-child-item text="Link" url=""></e-menu-child-item>
                    <e-menu-child-item text="Comments" url=""></e-menu-child-item>
                    <e-menu-child-item text="Header" url=""></e-menu-child-item>
                    <e-menu-child-item text="Footer" url=""></e-menu-child-item>
                </e-menu-child-items>
            </e-menu-item>
            <e-menu-item text="Help" url="">
                <e-menu-child-items>
                    <e-menu-child-item text="Docs Help" url=""></e-menu-child-item>
                    <e-menu-child-item text="User Forums" url=""></e-menu-child-item>
                    <e-menu-child-item text="Report an Issue" url=""></e-menu-child-item>
                    <e-menu-child-item text="Keyboard Shortcuts" url=""></e-menu-child-item>
                </e-menu-child-items>
            </e-menu-item>
        </e-menu-items>
    </ej-menu>

    The following screenshot displays the output of the above code.

    Center Menu