Tuesday, July 22, 2014

How To Remove Extra Space Around the Web Part In SharePoint 2013

We can remove extra space on webparts in sharepoint 2013 easily as follows:

An extra padding of 20 pixel is included by default in SharePoint 2013 for every webpart.
This may be inconvenient depending on the scenario how you are displaying the content in your Visual WebPart. 

To remove the extra space injected to the Webpart, add the below css in your .ascx file of Visual webapart. This would get rid of the extra space rendered around your webpart

<style type="text/css">
     .ms-webpartPage-root {
         border-spacing: 0px !important;
     }
       .ms-webpartzone-cell {
         margin: 0px !important;
     }
 </style>