简体   繁体   中英

How to align vertical submenu items with parent menu

I have a vertical menu which shows submenu items on hover.I want to align the submenu according to the parent menu item. i am bringing the menu and submenu items through a repeater. i want the submenus to be reponsive as shown in the images. Use this link for example: http://www.industrybuying.com/

    <div class="vertical-menu-content">
                                <ul class="vertical-menu-list">
                                    <asp:Repeater ID="rptVerticalMenu" runat="server" OnItemDataBound="rptVerticalMenu_ItemDataBound">
                                        <ItemTemplate>

                                            <li class="vertical-menu4">
                                                <a href="Product_List.aspx?cat=<%#Eval("BasicCategoryName")%>" class="parent linkSize">
                                                    <asp:Label ID="lblCatList" runat="server" Text='<%#Eval("BasicCategoryName")%>'></asp:Label>
                                                </a>
                                                <div class="vertical-dropdown-menu">
                                                    <div class="vertical-groups">
                                                        <div class="row">
                                                            <div class="col-sm-4">
                                                                <div class="block-content-vertical-menu border-left">
                                                                    <h3 class="head">CATEGORIES</h3>
                                                                    <div class="inner">
                                                                        <ul class="vertical-menu-link">
                                                                            <asp:Repeater ID="rptVerticalSubMenu" runat="server">
                                                                                <ItemTemplate>
                                                                                    <li>
                                                                                        <a href="Product_List.aspx?cat=<%#Eval("CategoryName")%>">
                                                                                            <asp:Label ID="lblCatName" runat="server" CssClass="text" Text='<%#Eval("CategoryName")%>'></asp:Label>

                                                                                        </a>
                                                                                    </li>
                                                                                </ItemTemplate>
                                                                            </asp:Repeater>
                                                                        </ul>
                                                                    </div>
                                                                </div>
                                                            </div>

                                                           <%-- <div class="col-sm-4">
                                                                <div class="block-content-vertical-menu border banner-hover">
                                                                    <a href="#">
                                                                        <img src="WebTheme/TransMax/data/banner/b42.png" alt="Banner"></a>
                                                                </div>
                                                            </div>--%>
                                                        </div>
                                                    </div>
                                                </div>
                                            </li>

                                        </ItemTemplate>
                                    </asp:Repeater>



                                </ul>
                            </div>

You could take the classes for the UL elements plus the Header tag (h3) and reset the browsers default margin and padding properties to your settings.

.vertical-menu-list, .vertical-menu-link, h3{
    margin: 5px;
    padding:5px;
}

Or target the elements themselves.

ul, h3{
    margin: 5px;
    padding:5px;
}

This all depends on there being no other margin or padding styles on the other elements in between.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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