How to remove std div in magento

I was trying to remove the "std div" from my magento home page, but unable to find the same any suggestion.

The div you are looking for is a page/html_wrapper block being added via the cms.xml layout file.

Here is the excerpt taken from app/design/frontend/base/default/layout/cms.xml:

<cms_page translate="label">
        <label>CMS Pages (All)</label>
        <reference name="content">
            <block type="core/template" name="page_content_heading" template="cms/content_heading.phtml"/>
            <block type="page/html_wrapper" name="cms.wrapper" translate="label">
                <label>CMS Content Wrapper</label>
                <action method="setElementClass"><value>std</value></action>
                <block type="cms/page" name="cms_page"/>
            </block>
        </reference>
    </cms_page>

So, there are a couple of ways to remove the div depending on how you develop your themes.

First option would be applicable if you use local.xml:

    <cms_page>
        <reference name="content">
            <action method="unsetChild">
                <alias>cms.wrapper</alias>
            </action>
            <block type="cms/page" name="cms_page"/>
        </reference>
    </cms_page>

Second option would be applicable if you copy the base layout files over:

Copy cms.xml from app/design/frontend/base/default/layout/cms.xml to app/design/frontend/your_package/your_theme/layout/cms.xml and edit the first layout snippet from above to the following:

   <cms_page translate="label">
        <label>CMS Pages (All)</label>
        <reference name="content">
            <block type="core/template" name="page_content_heading" template="cms/content_heading.phtml" />
            <block type="cms/page" name="cms_page" />
        </reference>
    </cms_page>

Part of this means removing empty elements, such as the infamous <div class="std"> </div> . The most efficacious way to get rid of this (as I don't plan on using the admin panel for content) is with <remove name="cms. wrapper"> in the CMS Home Layout Update XML. Noticed that Magento 1.4.1 has this structured a little differently. It has the line breaks already turned off--doesn't include nl2br, and rather uses a built in WYSIWYG editor for the description section. If you want to go back to the old way of line breaks, and don't want to use the WYSIWYG editor.

This code helped me to remove "std" div from a single cms page, put it to "Layout Update XML" section:

<reference name="content">
<action method="unsetChild">
<alias>cms.wrapper</alias>
</action>
<block type="cms/page" name="cms_page"/>
</reference>

code helped me to remove "std" div from a single cms page, put it to "Layout Update XML" section: <reference name="content"> <action method="unsetChild"​>  I am trying to create a cms page. My problem is any content I put in is distorted by a div put in from the theme. I would like to remove this div from this page only. Can anyone point me in the right direction to either remove the div or the template from this page?

EDIT: Drew asked a question which makes me realize that your questions was how to remove the div (not just remove the class of the div). Ideally it's like any other "move" operation in layout XML, which means unsetting a parent-child relationship (in this case the one between the cms.wrapper and cms_page) and setting the child to another block (content):

<?xml version="1.0"?>
<layout>
     <cms_page>
         <reference name="content">
             <action method="unsetChild">
                <alias>cms.wrapper</alias>
             </action>
             <action method="insert">
                <alias>cms_page</alias>
             </action>
         </reference>
    </cms_page>
</layout>

My original response is below:

Drew has a lot of good information in his answer. I'll just point out that the block API has some nuance that can make the layout XML very clean.

In your local.xml:

<?xml version="1.0"?>
<layout>
     <cms_page translate="label">
        <reference name="cms.wrapper">
            <action method="unsetElementClass" />
        </reference>
    </cms_page>
</layout>

Ref Mage_Page_Block_Html_Wrapper->_toHtml() and Varien_Object->__call()

Remove <div class="std"></div> from most of the pages. -->. < cms_page >. < reference name = "content" >. < action method = "unsetChild" >. Is your product description or short description spaced out in magento even though you haven’t added any line breaks? It happens because magento adds automatic line breaks into the content description and short description area using the PHP’s nl2br function.

Here is the solution you are finding :)

Put this xml code in Page -> Design -> Layout Update XML

<block type="page/html_wrapper" name="cms.wrapper" translate="label"> 
<label>CMS Content Wrapper</label> 
<action method="setElementClass"><value>your_class_name</value></action> 
<block type="cms/page" name="cms_page"/> 
</block>

Cheers!

Saran

what can i do to remove it from the top ? 0 Kudos <div class="std> </div>. <?​php endif; ?> Also note that i changed the Mage::getModel to  First we will show the example how we remove the breadcrumbs block. Use the handle of referenceBlock and add the name reference you want to remove. You can check the layout files where the breadcrumbs block is define. Remove Block. Now we add example code in our default.xml or you want to remove for any specific page block then add his layout file.

Modifying method arguments. Canceling block/container removal using the remove attribute. Setting XML attributes of blocks and containers. Solved: Hello again, I notice that the sku number is showing in the product grid in my homepage. Is there anyway to remove this so that only the

Adicionando bloco de conteúdo à Página Inicial, removendo 'std' <div> muito longe de ser proficiente em Magento; o que estou pedindo é a melhor e mais concisa O problema é que isso remove tudo o que adiciono com o método acima  How to remove auto added break (<br />) tag from product description of magento Facebook Twitter Google + Share Reddit Digg Stumble Delicious More If you work with Magento, you will see- By default Magento adds many undesired break (<br />) tag on product description automatically.

The best thing about adding microdata to your Magento product pages is that they <div class=”std” itemprop=”description”><?php echo We often recommend it's easiest to remove the default microdata with this free  An article describes one of the methods of customizing Magento Contact Us page from the Admin panel, without a need to edit files.

Comments
  • Heh, hate to be a nudge, but it seems worth pointing out an acadamic - as opposed to functionally meaningful - point: the middle option (for local.xml) will create a new Mage_Cms_Block_Page instance which overwrites the original one. Though I can't imagine a single visible effect for OOB CMS rendering, it may be relevant in edge cases.
  • You are right, though i'm not sure off the top of my head that there is a simple way of completely removing the outer wrapping div whilst keeping the original inner cms/page block intact? Do you know of a way to achieve this?
  • So obvious now (ashamed I didn't spot that) :)
  • That's the danger with such an esoteric & undocumented gem as layout XML & block API.
  • this code puts a div instead of "std", but how to complete remove this div from DOM?