0

I'm using Magento 2 and trying to change the header part of the theme. I want the search box next to the logo Title "Electro store" as shown in image also i want to know how to change the css of search box and add a submit button by removing search icon and advance search link.

"Electro Store" Title is CMS Static Block which i've created in admin panel and used below code in /var/www/html/magento226/vendor/magento/module-theme/view/frontend/templates/html/header/logo.phtml,

<?php echo $this->getLayout()->createBlock('Magento\Cms\Block\Block')->setBlockId('Electro-Title')->toHtml();?>

Below code is showing me search box in header links(next to register and login links),

<move element="top.search" destination="header.panel" before="-"/>

I tried to add float:left; css to block-search class in styles-l.less file,as suggested in this forum Move Search Bar but that's not working. Everytime i run this command php bin/magento cache:flush in terminal it removes the changes in file.

Let me know if anyone have solution or query about question.

enter image description here

  • but i would still like to know how to do with <move> tag without using css – Mohit Rane Oct 31 '18 at 6:42
0

You have done it right but add your own css for any customiztion of css otherwise it will gone when you update your magento or theme.

You can add your css by this link

Thank you

0

I found a solution.

I created _extend.less file under

/var/www/html/magento226/app/design/frontend/Rock/Electro/web/css/source/_extend.less

where i made my custom changes

.block-search
{ 
   float:left; 
}

and it worked.

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.