A group of Microsoft Products and technologies used for sharing and managing content, knowledge, and applications.
Hi @Ho, Anson,
To make the web part full-width, you'll need to apply CSS styles to the web part. Since Script Editor is unavailable for SharePoint modern page. We will need to deploy a spfx web part to apply CSS styles to the web part. You will need take following steps, please make a reference
- Set up your development environment install following package
npm install gulp-cli yo @microsoft/generator-sharepoint --global
- Create a new SPFx project
- Customize your web part
Inside the newly created project directory, navigate to the src/webparts folder. You will find the scaffolded web part under a folder with the name you provided during project creation.
Modify the web part code to suit your needs. You can update the React component in the YourWebPartName.tsx file to render your desired content.
- Make the web part full-width
To make the web part full-width, you'll need to apply CSS styles to it. Open the YourWebPartName.module.scss file and add a CSS rule to make it full width. For example:
.fullWidthWebPart {
width: 100%;
}
- Build and package your solution
gulp build
gulp bundle --ship
- Deploy and test your solution
Upload the .sppkg file to your SharePoint app catalog. Then add the web part to a page and ensure that it displays as full-width.
Here is the document for more details about spfx
https://learn.microsoft.com/en-us/sharepoint/dev/spfx/set-up-your-developer-tenant
If the answer is helpful, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment".
Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.