4

enter image description here

  1. How to remove name css page-header in tag header ?
  2. How to remove tag <div class="panel wrapper"> or <div class="panel header">in Magento 2?
6
  • do you want to remove all containers from header, because your top links comes in panel header Aug 28, 2017 at 9:12
  • No, I want to use tag header but I don't use class page-header in tag header. Because I custom my theme . Aug 28, 2017 at 9:22
  • I hope , it worked for you ? any problem then let me know Aug 28, 2017 at 10:16
  • Yes, I have several problems when I custom my theme . I want to ask you. Can you help me ? Aug 28, 2017 at 14:22
  • Sure, whatever possible I ll will help...kindly post your problems...if not me then someone else will help you Aug 28, 2017 at 23:42

2 Answers 2

6

1) To change class of Header Tag , edit your extended/custom default.xml

app/design/frontend/vendor-name/theme-name/Magento_Theme/layout/default.xml

Now add this line of code to change the class , here I changed page-header to test

<referenceContainer name="header.container"  htmlClass="test" />

2) To remove tag <div class="panel wrapper"> or <div class="panel header">

add below code in extended default.xml

<referenceContainer name="header.panel.wrapper" remove="true" />
<referenceContainer name="header.panel" remove="true" />

This should work for you as I just tested it.

0
0

For this page-header you need to add to your current theme in xml layout, this <referenceContainer name="header.container" htmlClass=""/>.

For this <div class="panel header"> you need to add to your current theme in xml layout, this <referenceContainer name="header.panel" htmlClass=""/>.

For this <div class="panel wrapper"> you need to add to your current theme in xml layout, this <referenceContainer name="header.panel.wrapper" htmlClass=""/>.

Ex. for comment:

<referenceContainer name="header.panel.wrapper">
    <block class="Magento\Framework\View\Element\Template" name="skip_to_content" template="Magento_Theme::html/skip.phtml">
        <arguments>
            <argument name="target" xsi:type="string">contentarea</argument>
            <argument name="label" translate="true" xsi:type="string">Skip to Content</argument>
        </arguments>
    </block>
    <block class="Magento\Store\Block\Switcher" name="store_language" as="store_language" template="switch/languages.phtml"/>
    <block class="Magento\Framework\View\Element\Html\Links" name="top.links">
        <arguments>
            <argument name="css_class" xsi:type="string">header links</argument>
        </arguments>
    </block>
</referenceContainer>
7
  • thanks for your answer, I tested and it is ok, but I want to remove <div class="panel header"> . Aug 28, 2017 at 13:41
  • <referenceContainer name="header.panel" remove="true" />
    – St3phan
    Aug 28, 2017 at 13:43
  • <?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"> <body> <referenceContainer name="header.panel" remove="true" /> </body> </page>
    – St3phan
    Aug 28, 2017 at 13:54
  • [![enter image description here][1]][1] [1]: i.sstatic.net/z7f0F.png. I tested it, but it will remove all tag inside tag <div class="panel header">. I want to keep all tag inside <div class="panel header">. You can see in this picture. So, how to do it ? Thanks Aug 28, 2017 at 13:55
  • You need to check this file and line /vendor/magento/module-theme/view/frontend/layout/default.xml:35 and you need put all inside header.panel in to other container. EX: goo.gl/AzG5sH
    – St3phan
    Aug 28, 2017 at 13:59

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.