0

我在 asp.net VB 中的树视图控件有一个烦人的问题,它在扩展菜单时将内容页面区域向下推。

我创建了适当的 div 来分隔各个部分

母版页非常基本:-

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title></title>
    <link href="StyleSheet.css" rel="stylesheet" type="text/css" />
    <asp:ContentPlaceHolder id="head" runat="server">
    </asp:ContentPlaceHolder>
</head>
<body>
    <form id="form1" runat="server">

    <div id="wrapper">

    <div id="header">

    <h1>This is header</h1>

    </div>

       <div id="nav">
        <asp:TreeView ID="TreeView1" runat="server" DataSourceID="SiteMapDataSource1" 
               ImageSet="BulletedList2" ShowExpandCollapse="False">
            <HoverNodeStyle Font-Underline="True" ForeColor="#5555DD" />
            <NodeStyle Font-Names="Verdana" Font-Size="8pt" ForeColor="Black" 
                HorizontalPadding="0px" NodeSpacing="0px" VerticalPadding="0px" />
            <ParentNodeStyle Font-Bold="False" />
            <SelectedNodeStyle Font-Underline="True" ForeColor="#5555DD" 
                HorizontalPadding="0px" VerticalPadding="0px" />
        </asp:TreeView>
        <asp:SiteMapDataSource ID="SiteMapDataSource1" runat="server" />
    </div>


    <div id="content">
        <asp:ContentPlaceHolder id="ContentPlaceHolder1" runat="server">

        </asp:ContentPlaceHolder>
    </div>


    <div id="footer">
    <p>This is footer</p>
    </div>

    </div>
    </form>
</body>
</html>

CSS是: -

body {


}
#wrapper{
    margin:0 auto;
    width:780px;
}


#nav{

    width:100px;
    border:1px solid black;
    padding:5px;


}


#header{

    height:100px;
    background:blue;
    color:white;
    float:left;
    width:100%;
}

#content{
    margin-left:110px;
    border:1px solid black;
    background:yellow;
    float:left; 

    width:600px;

}


#footer{
    height:200px;
    background:pink;
    clear:both;

}

Treeview 只是将内容页面向下推,我觉得我已经尝试了所有方法,除了使用表格。

4

1 回答 1

0

我猜你必须正确使用 float 和 z-index 属性,例如

nav{width: 100px; height: 100px; float: left; z-index: 1;}
于 2012-04-24T13:00:52.417 回答