I have the below XML which adds my static block to the page sidebar, then removes the wishlist. I would like to add a div wrapper to this static block with a css class.
I thought this could be done with the following argument, but it does not work.
<argument name="css_class" xsi:type="string">faq</argument>
Here is the full XML so far if anyone could help it would be appreciated.
<referenceContainer name="sidebar.additional">
 <block class="Magento\Cms\Block\Block" name="faq_sidebar">
 <arguments>
 <argument name="block_id" xsi:type="string">faq_sidebar</argument>
 <argument name="css_class" xsi:type="string">faq</argument>
 </arguments>
 </block>
</referenceContainer>
2 Answers 2
You can add class like this
<referenceContainer name="sidebar.additional" htmlClass="css_class" htmlTag="div">
 <block class="Magento\Cms\Block\Block" name="faq_sidebar">
 <arguments>
 <argument name="block_id" xsi:type="string">faq_sidebar</argument>
 <argument name="css_class" xsi:type="string">faq</argument>
 </arguments>
 </block>
Check this http://devdocs.magento.com/guides/v2.0/frontend-dev-guide/layouts/layout-types.html
For adding class or div wrapper to a block I would suggest to use container. eg-
<container name="div.faq.block" htmlTag="div" htmlClass="faq_sidebar" after="-">
 <block class="Magento\Cms\Block\Block" name="faq_sidebar" >
 <arguments>
 <argument name="block_id" xsi:type="string">faq_sidebar</argument>
 </arguments>
 </block>
</container>