views:

32

answers:

5

In both IE8 and Firefox I am experiencing the following:

I have a panel that is 30px in height, within this panel I have a single row table with 30px in height. When it displays on the browser window the table does not fill the height of the panel (there is a small amount of the panel showing on the top and bottom. How do I correct this so that the table takes up the entire height of the table?

HEADERPANELTABLE CSS:

table.masterHeader
{
    background-color:transparent;
    border-collapse:collapse;
    height:30px;
    margin-left:auto;
    margin-right:auto;
    margin-top:0;
    margin-bottom:0;
    padding:0;
    display:block;
    width:820px;
    }

HEADERPANEL CSS:

.HeaderPanel
        {
            background-color:#0079d0;
            height:30px;
            margin-left:auto;
            margin-right:auto;
            margin-bottom:0px;
            margin-top:0px;
            padding:0;
            width:820px;
            }

SPACER CSS:

div.Spacer
{
    background-color:transparent;
    height:30px;
    }

MAINPANEL CSS:

.MainPanel
{
    background-color:#6699cc;
    height:700px;
    margin-left:auto;
    margin-right:auto;
    width:820px;
    }

HTML CODE:

<asp:ToolkitScriptManager ID="ToolkitScriptManager1" runat="server">
</asp:ToolkitScriptManager>
<div class="Page">
    <asp:Panel ID="HeaderPanel" CssClass="HeaderPanel" runat="server">
        <table class="masterHeader" cellspacing="0" cellpadding="0">
            <tr>
                <td class="Account"></td>
                <td class="Name"></td>
                <td class="Spacer"></td>
                <td class="CompanyName"></td>
                <td class="Logout"></td>
            </tr>
        </table>
    </asp:Panel>
    <asp:RoundedCornersExtender ID="HeaderPanelRounded" TargetControlID="HeaderPanel" runat="server" Radius="3" Corners="Bottom"></asp:RoundedCornersExtender>
    <div class="Spacer">&nbsp;</div>
    <asp:Panel ID="MainPanel" runat="server" CssClass="MainPanel">
        <div class="main">
            <asp:ContentPlaceHolder ID="MainContent" runat="server"/>
        </div>
    </asp:Panel>
</div>
<asp:RoundedCornersExtender ID="rceMainPanel" runat="server" TargetControlID="MainPanel" Radius="3">
</asp:RoundedCornersExtender>
A: 

set the cellspacing to 0

<table cellspacing="0">
   <tr>
      <td></td>
   </tr>
</table>
Rocket Ronnie
I totally forgot about cellspacing, however, this idea didn't work
mattgcon
How about resetting the margin and padding for the table ie table{margin:0; padding:0;}
Rocket Ronnie
tried that too, but it didn't do the job.
mattgcon
Post some code if you can
Rocket Ronnie
A: 

Have you looked at the page in something like Firebug, where you can look at each DOM element, see the attributes (like margin, padding, and so on). That way you might be able to see exactly where that extra spacing is coming from, and what styling attributes are being applied to each element.

Ken Ray
Yeah I have, but I can't seem to find the problem area. I do have a spacer in between the top panel (panel in question) and the main panel and that spacer is bleeding into the top panel about 4-5 pixels.
mattgcon
How would I go about showing you the code in question?
mattgcon
you can edit your original post to include it
Rocket Ronnie
Ok I added it to my original posting
mattgcon
Think you may have forgot to wrap your html in the code tags
Rocket Ronnie
Oh that is just a snippet of code, the complete html tag set is there
mattgcon
Yeah that is exactly what happened
mattgcon
Ok, I/m clutching at straws a bit here, but I would first remove all "excess baggage" - the RoundedCornersExtender, the spacer div, and so on. If with just your panel and it's containing table, it works properly, then add one thing at a time, until it breaks.
Ken Ray
LOL first thing I removed fixed the problem (RoundedCornersExtender) now I have naother problem though. The rounded corners are required by the client.
mattgcon
I have an idea, what if I extract the table from the panel and place it in a div and somehow place the div and table above the panel? Wouldthat work and if so how do I do that.
mattgcon
Ok my idea actually worked
mattgcon
A: 

You haven't posted code (HTML or CSS) or stated what browsers you are seeing this in, so difficult to know for sure. Some suggestions:

  • make sure your table has zero margins
  • make sure the panel doesn't have any padding
  • make sure cell spacing is zero
  • make sure some other element isn't blocking the table
  • make sure your css styling is not being over-ridden somewhere

If you don't have it already, you should install the Firebug addin https://addons.mozilla.org/en-US/firefox/addon/1843/ for Firefox. This makes it extremely easy to inspect the DOM and CSS styling applied.

Richard
Ok I added the fact that I am using IE8 and Firefox and experiencing it in both
mattgcon
I don't know asp, is that the html that's actually sent to the browser? Given all the server tags, I imagine not. So post the html that's actually sent to the client, or better yet, a link to the page.
Richard
A: 

I notice that you aren't doing anything about your table borders. Could this be the gap you are seeing? If your borders have any width for any reason then they could be showing which might be giving you the effect in question.

I made a quick jsfiddle proof of concept based on what I assume your outputted HTML will look like in its simplest form. I'm not familiar with the RoundedCornersExtender control though and I suspect that is modifying the HTML of the main div.

http://jsfiddle.net/tAgp3/1/

You can see that this simplified form works but I assume that the rounded corners is trying to do some nasty tricks with embedding extra DIVs with background to do rounded corners. These could be what is causing your additional padding.

Again I ask if you can post the actual html outputted to the browser so we can see if this is the case or not.

Chris
Actually the border is set to collapsed the background color is tranparent
mattgcon
ooops. I misread that, will edit answer. Still, you aren't actually getting rid of your borders explicitly there. Border-collapse only choose what your border model is, it doesn't collapse them to nothing.
Chris
A: 

Because an ASP:Panel breaks up the panel into div tags and with rounded corners it add anothe 1px border to the panel which is placed after the table has been placed. In order to fix this the table had to be placed within a div tag and float the div above the panel.

mattgcon