1

I want to define some static blocks in the header and footer of my theme but I don't want to define css for their responsiveness.

Can I define static blocks, managed by magento admin panel for my front-end theme without damaging responsiveness of theme template?

This is my header

enter image description here

here i have add this static block (Get 30-40% off on over 1,50,00 style). I want to edit this block by admin panel without defining responsive css.

  • Design depends on kind of content you are giving in static block.So the need of css. Can you share more info. – Ahmad Vaqas Khan Oct 5 '17 at 8:54
  • need to define simple blocks like these..do i need to define css – Rajat Gupta Oct 5 '17 at 9:08
1

Static blocks have nothing to do with CSS or responsiveness, all they do is render the contents of the respective static block.

To load a static block you have a few options:

Via XML

<block class="Magento\Cms\Block\Block" name="footer.links.block" as="footerLinksBlock">
    <arguments>
        <argument name="block_id" xsi:type="string">block_identifier</argument>
    </arguments>
</block>

Via Template

<?php echo $block->getLayout()->createBlock('Magento\Cms\Block\Block')->setBlockId('block_identifier')->toHtml();?>

Via CMS page or another static block

{{block class="Magento\Cms\Block\Block" block_id="block_identifier"}}
  • but content of the newly defined block don't adjust according to screen size (mobile view, desktop view) – Rajat Gupta Oct 5 '17 at 9:24
  • Nope, you need to write your own CSS for that. Static blocks do not have any responsive functionality, it literally renders whatever you add to your static block. – Ben Crook Oct 5 '17 at 9: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.