0

I have the following HTML

<td class="myclass">This is text</td>

I am using a webpart to display this text. So now my code looks like:

<td class="myclass"><INSERT WEB PART ZONE HERE></td>

Now when I add Content Editor web part in above place, and write text "This is text" using "Edit Source" option of content editor web part, then it results in something like this:

<td class="myclass"><div class="sharepoint_29834jbdf"><div id="8sjkdfjkdf">This is text</div></div></td>

So what's happening is, Sharepoint is adding extra HTML in it which overrides my CSS class "myclass" and results in text being different than what I want it to be.

How do I fix it?

  • 1
    Well, if you use a webpart in a webpart zone, it will always render some DOM elements to be able to render the content of the webparts. – Robert Lindgren Jul 16 '13 at 10:32
  • Then what's the point of this web part if you can't render text according to your CSS? – Frank Martin Jul 16 '13 at 16:42
  • 1
    If I where you I would modify my CSS to work properly.. The web part is a good way for end users (publishers) to be able to add text with formatting, simple scripts and such. You as a developer has other, more powerful tools like user controls and HTML directly on the page – Robert Lindgren Jul 16 '13 at 17:27

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.