I'm currently developing application pages for a SharePoint 2010 server using Visual Studio 2012.

My question is simply, is there a way to add CSS classes to the <asp:Content ID="Main" ContentPlaceHolderID="PlaceHolderMain" runat="server"> tag within these pages?

CssClass and Class do not appear to work in this case (tried both without success).

Thank you.


The placeholder tag will not be rendered to the final html itself, but its content will, so it wouldn't make any difference if you could add the css class to it.

What you can do, is create one div element inside your placeholder tag which would wrap everything else and add the class to that div element.

That part of application page would look something like this:

<asp:Content ID="Main" ContentPlaceHolderID="PlaceHolderMain" runat="server"> 
   <div class="wrapper">
      The content...

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.