Home All Groups Group Topic Archive Search About

How to turn off padding within a Web Part?

Author
26 Jan 2006 5:03 PM
Terry Smith
Web parts are automatically generated with 5px of padding within their
container. This gets specified in the style attribute of one of the TD tags.
There are no properties to turn this off that I have found, and since the
padding gets generated into the style a CSS class will not override it.

Why does it matter? Because I want to build a toolbar on my web part, and it
needs to dock flush at the top with out 5x of white space around all sides.

I've written JavaScript to find the culprit TD and turn off the padding when
the page loads, but if you minimize/restore the web part it comes back. I
assume it would come back in other scenerios as well. I'll play with calling
the JavaScript on other events, but this is obviously a very bad hack. Is
there a better way?

Any thoughts? Have I missed something somewhere?

Thanks,
Terry
______________________
Terry Smith
Senior Architect
Insight Ecosystems

Author
26 Jan 2006 7:59 PM
Tatyana
Hi,



I have a similar problem I have a menu control which is being placed into a
Table, actually <td>.

Can not find why the cellpadding="0" and Cellspacing="0" does not work. The
menu is being displayed 2 px lower the top of the <td>

How to turn of the padding or what is it? I assume that then you place a
control into the table/tr/td there is some kind of different padding or
margin which is not overridable by the CSS.



Any ideas?



Thank you,

Tatyana

Show quoteHide quote
"Terry Smith" <TerrySm***@discussions.microsoft.com> wrote in message
news:F8931442-5F6D-4D4A-8F95-3EA9186FC3B0@microsoft.com...
> Web parts are automatically generated with 5px of padding within their
> container. This gets specified in the style attribute of one of the TD
tags.
> There are no properties to turn this off that I have found, and since the
> padding gets generated into the style a CSS class will not override it.
>
> Why does it matter? Because I want to build a toolbar on my web part, and
it
> needs to dock flush at the top with out 5x of white space around all
sides.
>
> I've written JavaScript to find the culprit TD and turn off the padding
when
> the page loads, but if you minimize/restore the web part it comes back. I
> assume it would come back in other scenerios as well. I'll play with
calling
> the JavaScript on other events, but this is obviously a very bad hack. Is
> there a better way?
>
> Any thoughts? Have I missed something somewhere?
>
> Thanks,
> Terry
> ______________________
> Terry Smith
> Senior Architect
> Insight Ecosystems
Author
29 Jan 2006 7:01 PM
DWS
Terry,
The webpartzone has a padding property set it to 0.
Good Luck
DWS


Show quoteHide quote
"Terry Smith" wrote:

> Web parts are automatically generated with 5px of padding within their
> container. This gets specified in the style attribute of one of the TD tags.
> There are no properties to turn this off that I have found, and since the
> padding gets generated into the style a CSS class will not override it.
>
> Why does it matter? Because I want to build a toolbar on my web part, and it
> needs to dock flush at the top with out 5x of white space around all sides.
>
> I've written JavaScript to find the culprit TD and turn off the padding when
> the page loads, but if you minimize/restore the web part it comes back. I
> assume it would come back in other scenerios as well. I'll play with calling
> the JavaScript on other events, but this is obviously a very bad hack. Is
> there a better way?
>
> Any thoughts? Have I missed something somewhere?
>
> Thanks,
> Terry
> ______________________
> Terry Smith
> Senior Architect
> Insight Ecosystems
Author
23 Feb 2006 9:14 AM
SteveR
Terry,
   try setting the 'PartChromeType' property to 'TitleOnly' this also seems
to remove the padding. Alternatively set the PartStyle-CssClass and define
the class as follows.

..NoPadding
{
    padding: 0px !important;   
}

The !important stops the browser from overriding this settings when it
renders the control. It seems to be a little known feature of CSS but it
works for me.
--
Steve


Show quoteHide quote
"DWS" wrote:

> Terry,
> The webpartzone has a padding property set it to 0.
> Good Luck
> DWS
>
>
> "Terry Smith" wrote:
>
> > Web parts are automatically generated with 5px of padding within their
> > container. This gets specified in the style attribute of one of the TD tags.
> > There are no properties to turn this off that I have found, and since the
> > padding gets generated into the style a CSS class will not override it.
> >
> > Why does it matter? Because I want to build a toolbar on my web part, and it
> > needs to dock flush at the top with out 5x of white space around all sides.
> >
> > I've written JavaScript to find the culprit TD and turn off the padding when
> > the page loads, but if you minimize/restore the web part it comes back. I
> > assume it would come back in other scenerios as well. I'll play with calling
> > the JavaScript on other events, but this is obviously a very bad hack. Is
> > there a better way?
> >
> > Any thoughts? Have I missed something somewhere?
> >
> > Thanks,
> > Terry
> > ______________________
> > Terry Smith
> > Senior Architect
> > Insight Ecosystems