Keep getting white space while div is floated.

Copper Contributor

Hello,

 

Thanks in advance for reviewing my white space problem. I have a relatively simple asp.net site that has floating div's to store the tree view. The problem is the container div for the tree view and the other content div's keep showing up with white space before them.

 

Not sure what the problem is but suggestions are appreciated. I have enclosed the sample code and an image of the results while previewing the code.

 

 

 

 

<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" Runat="Server">
    <div style="float:left; background-color:lightslategray; width:200px; height:350px">
        <asp:TreeView runat="server" DataSourceID="SiteMapDataSource1"></asp:TreeView>

        <asp:SiteMapDataSource ID="SiteMapDataSource1" runat="server" StartFromCurrentNode="True" />

    </div>
    <div>
        <h1>Web Site Development</h1>
        <table>
            <tr>
                <td>
                    <h2>Web Site Development</h2>
                    <p>This is a paragraph on Web Site Development.</p>
                </td>
                <td>
                    <h2>Mobile Web Site Development</h2>
                    <p>This is a paragraph on Mobile Web Site Development.</p>
                </td>
                <td>
                    <h2>Web Applications and Portals</h2>
                    <p>This is a paragraph on Web Application and Portals.</p>
                </td>
            </tr>
        </table>

    </div>
</asp:Content>

 

 

 

 

screenshot UPDATED asp.net white space (1).png

 

So basically when I have the two div's: one floating with tree view, and the other storing content (headings, page content...), what happens is there is a large white space section at the top of the page between master page navigation content and the page tree view and page content.

 

It would be appreciated if someone could figure out a way to get rid of all that whitespace towards the top of the page.

 

Thank you.

2 Replies

@AlphaCr8tive 

 

Bump... Anyone out there?

You have to review the rendered html source code (With Google Chrome browser, press F12, select tab Elements).

1/ Is there anything unintentionally inserted between your two divs?
2/ Review CSS attributes (Padding, Margin). Many elements have a default padding, margin greater than 0.