Magento – Magento 2: Update the CSS class name of #maincontent

classcssmagento2xml

Is there a way for me to remove the class name 'page-main' from the 'maincontent' div and add a new class name?

Best Answer

If you're interested, the answer is to use a referenceContainer in the XML file and add the new Class / ID names to the DIV / XML container.

For example:

<referenceContainer name="main.content" htmlTag="main" htmlId="add-ID-name-to-container" htmlClass="new-class-name"/>

The rendered DIV (main) will look like:

<main id="add-ID-name-to-container" class="new-class-name" >

    ...

</main>

The un-edited/updated version would look like:

<main id="maincontent" class="page-main" >

    ...

</main>
Related Topic