I want to move the search bar from right to the center of the homepage using xml.enter image description here

3 Answers 3

 <move element="block.search" destination="header-wrapper" after="logo" />

We have to add this in default.xml file

and then change the css accordingly, after that it will work fine.

  • <move element="block.search" destination="header-wrapper" after="logo" />
    – Zaid
    Commented Nov 13, 2017 at 4:53

If you're using magento2.3 then the correct file path is given below.


<?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">
         <move element="top.search" destination="header-wrapper" after="logo" />

And don't forget to flush magento cache.


Add this in css file,



  • We have to do it using xml.
    – Zaid
    Commented Nov 10, 2017 at 6:36

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.