0

How can I center the content of all the SharePoint Gallery cards?

enter image description here

1 Answer 1

1

Try this:

  1. Follow my answer given here up to step #4 to enter into advanced mode in gallery view formatting.

  2. Then add below styling to top/outer most div element in the JSON:

"style":{
    "text-align": "center"
},

Output:

enter image description here

If any column value is not aligned to center automatically, locate the code used in same JSON for that particular column and then add "text-align": "center" styling to nested elements wherever required.

6
  • Thanks only the profile picture doesn't align. I have tried this below but no luck: Commented Aug 5, 2023 at 6:28
  • "style": { "display": "=if(loopIndex('personIterator') >= 5, 'none', '')", "width": "72px", "height": "72px", "align": "center" }, Commented Aug 5, 2023 at 6:28
  • Are you showing person column and their profile picture in gallery view? Commented Aug 5, 2023 at 8:43
  • Yes i have a person column with the profile picture in gallery view :) Commented Aug 5, 2023 at 8:44
  • 1
    I found the problem :) The Problem was Display: flex and i change it to: Display;inline-block Commented Aug 6, 2023 at 8:37

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.