cancel
Showing results for 
Search instead for 
Did you mean: 

Wrap Block In Container

Wrap Block In Container

I am including the extension Ves MegaMenu in my theme in default.xml.
How can I wrap this within a container?

 

<referenceBlock name="page.wrapper">
    <block class="Ves\Megamenu\Block\Menu" name="catalog.topnav" after="header.container" template="Ves_Megamenu::topmenu.phtml">
        <arguments> 
            <argument name="alias" xsi:type="string">menu-top</argument> 
        </arguments> 
    </block>
</referenceBlock>

Thank you.

1 REPLY 1

Re: Wrap Block In Container

Hello christopher_oliver,

Please refer the below code to wrap the block in a container:

<referenceBlock name="page.wrapper">
    <container htmlTag="html_tag" htmlClass="your_container_class">
        <block class="Ves\Megamenu\Block\Menu" name="catalog.topnav" after="header.container" template="Ves_Megamenu::topmenu.phtml">
            <arguments> 
                <argument name="alias" xsi:type="string">menu-top</argument> 
            </arguments> 
        </block>
    </container>
</referenceBlock>

You can change html_tag of container with your prefer html tag and your_container_class by the class name which you want to assign to customer.

Hope it will help you. Smiley Happy