3

I found in documentation that "background-image" is supported attribute but I am not able to use it. Maybe I am doing something wrong. Could you help please, how to use "background-image" within JSON code?

Example:

{
    "elmType": "div",
    "style": {
        "text-align": "left",
        "background-image": "url('https://test.sharepoint.com/sites/TEST/SiteAssets/company_logo.png')"
    }
...

Thank you,

Mirek

1
  • Where are you trying this? in view formatting or column formatting? Refer this Commented Dec 8, 2020 at 9:15

1 Answer 1

2

This is expected behavior.

Currently style properties cannot have any of the following characters: (, :, &, ;, !.

If you will add "debugMode": "true" to your JSON code, you can see the error message like below in browser's console:

enter image description here

You can read more information about this issue at: Column formatting - URL not allowed in background-image style property

2
  • Thank you for your fast response! :) Then I do not just understand why it is as a supported attribute (docs.microsoft.com/en-us/sharepoint/dev/…). Quite confusing. Commented Dec 8, 2020 at 10:46
  • Yes, I checked that. Not sure why it is there. But, it should have been removed as mentioned by repo maintainer here. Commented Dec 8, 2020 at 11:47

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.