November Happy Hour will be moved to Thursday December 5th.

How to get rid of CSS classes generated in Content Area

Vote:
 

We're using EPiServer CMS 8.0 and using MVC. I noticed that EPiServer generates wrapping divs in Content Area including the blocks:

 

block

 

block

I really don't mind the extra divs but what I want to get rid of is the CSS in block's wrapping divs. I tried the following code:

@Html.PropertyFor(m => m.BannerContentArea, new { ChildrenCssClass = "" })

but it doesn't work. 

#121996
May 25, 2015 7:49
Vote:
 

Hi,

Looks like you have your custom ContentAreaRenderer. Default ContentAreaRenderer don't add classes.

AlloyContentAreaRenderer from AlloyMVC generate html as your example.

#122002
May 25, 2015 13:37
Vote:
 

To get rid of wrapping `div` element you can use following code:

@Html.PropertyFor (m => m.BannerContentArea, new { "hascontainer" = false })
#122018
May 25, 2015 23:03
Vote:
 

Or actually you can rely on some built-in constants as well:

RenderSettings.HasContainerElement
#122019
May 25, 2015 23:05
Vote:
 

I ended up creating a custom Content Area renderer http://wrzyciel.pl/force-episerver7-to-not-add-empty-divs-for-contentareas/

#122065
May 26, 2015 12:33
This topic was created over six months ago and has been resolved. If you have a similar question, please create a new topic and refer to this one.
* You are NOT allowed to include any hyperlinks in the post because your account hasn't associated to your company. User profile should be updated.