Skip to content

Instantly share code, notes, and snippets.

@AndreaRivadossi
Last active October 12, 2018 13:05
Show Gist options
  • Save AndreaRivadossi/f03eba32d0fc8454c2c1b2897c8d6bca to your computer and use it in GitHub Desktop.
Save AndreaRivadossi/f03eba32d0fc8454c2c1b2897c8d6bca to your computer and use it in GitHub Desktop.
Magento 2 - Add a CSS class to the body element
<?xml version="1.0"?>
<!--
/**
* Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/
-->
<page xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" layout="2columns-left" xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/page_configuration.xsd" label="Customer My Account (All Pages)" design_abstraction="custom">
<body>
<attribute name="class" value="account"/>
</body>
</page>
<referenceContainer name="root" htmlTag="div" htmlClass="my-custom-css-class" htmlId="my-custom-css-id">
</referenceContainer>
<?xml version="1.0"?>
<page xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/page_configuration.xsd" label="Customer My Account (All Pages)" design_abstraction="custom">
<body>
<attribute name="class" value="my-custom-css-class"/>
</body>
</page>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment