Add div using layout file magento 2
add below code in layout file as per needed based on router.

<referenceContainer name="">
    <container name="custom.view.container" htmlTag="div" htmlClass="custom-view" after="breadcrumbs">
        <block class="namespace\module\Block\entity" name="customView" template="namespace_module::custom.phtml" />

referenceContainer name can be any where we want to insert div. please make sure name where want to inject div.

if wants to move from one place to another use code as per given below

<move element="custom.view.container" destination="" before="page.messages" />

element - name which element needs to move.
destination - name of the destination container element.
before/after - as per needed sequence.

That's it...!!!

Experienced Magento Certified Developer with a demonstrated history of working in the information technology and services industry. Skilled in SQL, PHP, XAMPP, jQuery, and Microsoft Office. Strong engineering professional with a Master of Computer Applications


Post a Comment

Popular Posts

Have You Any Questins Let Us Know.

Contact Us
Ahmedabad India