Forum Discussion

Vincent1230's avatar
Vincent1230
Copper Contributor
Oct 19, 2023

How to adjust the size of a list view web part on a SharePoint page

Hello!

 

I'm having an issue adjusting the size of a list view web part on a SharePoint page. I embedded the list view on the homepage, but as you can see in the image, it's a bit large and has a scrollbar.

 

 

I only want to keep the size of the blue button section, so how can I adjust the size of the view and remove the scrollbar? By the way can I change the background color (the white background)? Below is my list view JSON code.

 

 

{
  "$schema": "https://developer.microsoft.com/json-schemas/sp/v2/tile-formatting.schema.json",
  "height": "20px",
  "width": "50px",
  "hideSelection": true,
  "formatter": {
    "elmType": "a",
    "txtContent": "My Page",
    "attributes": {
      "class": "sp-card-defaultClickButton",
      "role": "presentation",
      "target": "_blank",
      "href": "=[$Page]"
    },
    "style": {
      "margin": "100px",
      "padding": "10px",
      "height": "64px",
      "margin-right": "8px",
      "margin-botton": "10px",
      "font-size": "14px",
      "border-radius": "2px",
      "border": "none",
      "font-weight": "600",
      "background-color": "#0078d4",
      "cursor": "pointer",
      "color": "white",
      "text-decoration": "none",
      "text-align": "center",
      "width": "150px",
      "display": "inline-block",
      "vertical-align": "middle",
      "line-height": "3"
    }
  }
}

 

 

Thanks in advance!

 

Best Regards,

Vincent

No RepliesBe the first to reply

Resources