Is there any way to format text in SharePoint image captions?

Anonymous
2025-01-17T18:37:43+00:00

Is there any way to apply standard formatting, such as italics or font color, to captions on images in SharePoint pages? I am more interested in this for images placed in Text web parts, but I also can't format caption text for the Image web part.

Microsoft 365 and Office | SharePoint | For education | MacOS

Locked Question. This question was migrated from the Microsoft Support Community. You can vote on whether it's helpful, but you can't add comments or replies or follow the question.

0 comments No comments
Answer accepted by question author
Anonymous
2025-02-08T06:08:32+00:00

Dear James,

Yes, you are right.

Based on my test, custom script needs to be enabled for the Embed web part with HTML code. The administrator can enable it every 24 hours via SharePoint Online Management Shell. Set-SPOSite https://contoso.sharepoint.com/sites/sitename -DenyAddAndCustomizePages 0

The SPFX solution is the alternative way of the custom script. It runs within the SharePoint Framework and doesn't rely on the custom script settings for its execution.

@Webbrewers, there may be no specific article about that currently. Similarly, you can see the detailed information about the SPFX part in Security considerations of allowing custom script - SharePoint in Microsoft 365 | Microsoft Learn.

Thank you for your time and effort.

Sincerely

Cliff | Microsoft Community Moderator

Was this answer helpful?

1 person found this answer helpful.
0 comments No comments

28 additional answers

Sort by: Most helpful
  1. matt howell 3,511 Reputation points
    2025-02-03T22:37:58+00:00

    Actually the app catalog is its own site collection at /sites/apps/. So you'd manage any solutions there including the 3rd party modern script editor. One other shortcut I came across is you can add a modern script editor to a page and save it as a template. If you add a link to a stylesheet to the template web part, you can create pages from it with the stylesheet link included. The only caveat I've found is <style> tags in the script editor do not work, but links to stylesheet files and inline styling do. This is an easier option if you don't want to build your own SPFx solution which comes with a learning curve.

    Was this answer helpful?

    0 comments No comments
  2. Anonymous
    2025-02-03T22:01:51+00:00

    @webbrewers, thanks much for the very clear descriptions. They all match what I had gathered from the documentation, but it is extremely helpful to have confirmation.

    Motivated by your post, I've now learned that site collections can have individual app catalogs, so maybe that can be controlled without being an admin. I don't yet understand the instructions for managing it, but that is a question for another thread.

    Was this answer helpful?

    0 comments No comments
  3. Anonymous
    2025-02-01T08:22:55+00:00

    Dear James,

    Thanks for your updates.

    You can use both ways. They both uses the SPFX solution. I recommended Modern Script Editor web part as it works like the classic script web part which can insert any code such as CSS, HTML, JavaScript and so on.

    If you can contact the administrator, I suggest you let him deploy that, enable the custom script on the site and do a test to see the result.

    I testes the embed way and it also works. May I know whether you enabled the custom script on the site? If no, please let the administrator enable it.

    If it is convenient, I suggest you create a new library and save the code below as a .aspx file and then upload the file to the newly created library and embed it to see and let us know the outcome.

    <html>
      <head>
        <meta http-equiv="content-type" content="text/html; charset=windows-1252">
        <title>Intermediate Lab Experiments</title>
      </head>
      <body>
        <h2>Intermediate Laboratory Experiments</h2>
        <p>NOTE: Many of these pages contain copyrighted material.&nbsp; Use on this
          limited-access website is permitted.<br>
          Distribution of this material to any other online server, which would
          allow access to persons other than Geneseo students, is prohibited.</p>
      </body>
    </html
    

    Image

    Allow or prevent custom script - SharePoint in Microsoft 365 | Microsoft Learn

    Thank you for your time and effort.

    Sincerely

    Cliff | Microsoft Community Moderator

    Was this answer helpful?

    0 comments No comments
  4. matt howell 3,511 Reputation points
    2025-01-31T22:31:09+00:00

    SP Designer isn't related to the SPFX application customizer - as I said "You can then edit your custom stylesheet directly in Sharepoint Designer with no need to download/upload." It's just a more convenient way to open/edit a file directly. As for the pros and cons of the script editor web part vs an spfx solution, the web part will only affect things for the page it's added to. For sitewide changes, spfx is the way to go. It adds a stylesheet so you can change things without adding a web part to every page, and you can also restyle libraries etc that you can't with a web part. I don't believe you have to be an admin to add the solution but I could be wrong.

    Was this answer helpful?

    0 comments No comments