I am running Magento 2.2. I have custom HTML I want to add to a CMS page. After navigating to the page where this HTML resides, the content is automatically displayed inside a div with class page-wrapper. Then inside that div there is a main tag with an ID of maincontent and classes of page-main and padding-bottom-0. All I want to do is show the custom HTML in the content area of the cms page inside the body of what is loaded. I do not want to have the other elements. I don't know where they are coming from and their CSS is manipulating my custom HTML, which is what I am trying to avoid. The design of the cms page is set to the empty default magento design, which I thought would be empty, but apparently it is not. Any help here would be greatly appreciated.


1 Answer 1


Instead of messing around with the layout files, I just added custom CSS inside style tags with the html editor inside the magento 2 page design area. Then Added custom js with a script tag in the same editor that selected the divs that were already there and removed their css classes. The divs are still there which is not a problem in my case as it was only their css classes that were giving me problems. Thanks for your time and responses.

The script looks like this.

var maincontent = document.querySelector("#maincontent > div.columns.container.offset-0") maincontent.classList.remove("columns", "container", "offset-0");

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.