1

i use magento 2.1.1. i want to create a top links in left or right side above header. i attaching the following image of..My Html page i want to add a links like All flowers, All cakes, etc to left side and delivery, currency in right side at the top of header, but in Magento 2 layout overview link, display in right side. how i add a left side header links in magento 2...? please help...

0

You can use the below code to your default.xml

<?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">
            <container name="header-category" label="Header Category" as="header-category" htmlTag="div" htmlClass="header-category-wrapper" before="-">
                <block class="Magento\Framework\View\Element\Template" name="header_category" as="header_category" template="Magento_Theme::html/header/categories.phtml"/>
            </container>
        </referenceContainer>
    </body>
</page>

Now create one file named categories.phtml under

app/design/frontend/[Your_Package]/[Your_Theme]/Magento_Theme/templates/html/header/categories.phtml

Now here you can add your code. After this you can manage that particular container whose class is "header-category-wrapper" by css.

.header-category-wrapper{float:left;}

And add some more styling and adjustment according to your requirement.

Hope this helps!

  • thanks, but all css of header was removed. i adding a cutom css was not applied, i add a <css src="css/styles.css"/> in head tag. – Kishor Admane May 31 '18 at 12:33
  • Don't remove the existing content of default.xml only add the code I have written here. – Sukumar Gorai May 31 '18 at 12:53

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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