I created HTML field in SharePoint 2010

<Field ID="{3E83492C-0420-473E-AB65-E4355535AFD0}" Name="MyField" StaticName="MyField" DisplayName="My Field" Type="HTML" Required="FALSE"  RichText="TRUE" RichTextMode="FullHtml" >
  <![CDATA[<div style="background-image:url('http://mytest.com/image.jpg');"><h1>Sample title<h1> <p>sample text</p></div>]]>

But when I adding new item to list with this field I don't see background.

When I adding this value manually to field I see image, but if I click Save and open again this field, then this image disappear.

How can I fix this?


if I added image in html not as a background then it works

<div class="grid_6"> 
        <a href="#"> 
            <img src="http://mytest.com/image.jpg'"/>

Another approach is you can add a separate script editor web part on your page and add your styles there.

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.