SharePoint 2013: Remove extra space around webpart

Posted: April 24, 2015 in SharePoint

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>

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s