Removing extra space around the Web Part

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;