如何正确对齐图表

时间:2013-07-10 06:05:23

标签: css html alignment

我正在尝试将图表与菜单对齐。实际上他们的身高与左边的菜单不一样..

div:

<nav>
  <div class="menu-item alpha"> 
  <h4><a href="index.aspx" style="color: #EDEDED">Home</a></h4>           

  <p>To Navigate to Home Page</p> 
</div>   

<div class="menu-item"> 
<h4><a href="#">KPIs</a></h4> <!-- colored bar --> 

<ul> <!-- expanding white area --> 
  <li><a href="#">Churn Rate</a></li> 
  <li><a href="#">Dormont Users</a></li> 
  <li><a href="#">Other</a></li> 
</ul> 

</div> 


</nav>

表格分区:

       <table border="1" align="right" >
  <tr>
    <th>Chart 1</th>
    <th>Chart 2</th>
  </tr>
  <tr>
    <td>
    <asp:Chart ID="Chart1" runat="server" DataSourceID="SqlDataSource1">
        <Series>
            <asp:Series Name="Series1" ChartType="Line" XValueMember="Activity" YValueMembers="NumberOfStudents" YValuesPerPoint="2"></asp:Series>
        </Series>
        <ChartAreas>
            <asp:ChartArea Name="ChartArea1"></asp:ChartArea>
        </ChartAreas>
    </asp:Chart>
        <asp:SqlDataSource ID="SqlDataSource1" runat="server" ConnectionString="<%$ ConnectionStrings:ConnectionString %>" ProviderName="<%$ ConnectionStrings:ConnectionString.ProviderName %>" SelectCommand="SELECT * FROM [FavouriteActivities]"></asp:SqlDataSource>
</td>
<td>
        <asp:Chart ID="Chart2" runat="server" DataSourceID="SqlDataSource1">
        <Series>
            <asp:Series Name="Series1" ChartType="FastPoint" XValueMember="Activity" YValueMembers="NumberOfStudents" YValuesPerPoint="2"></asp:Series>
        </Series>
        <ChartAreas>
            <asp:ChartArea Name="ChartArea1"></asp:ChartArea>
        </ChartAreas>
    </asp:Chart>
</td>
  </tr>
</table>

这是发生的事情:  enter image description here

这是应该发生的事情:

enter image description here

你可以帮帮我吗?

2 个答案:

答案 0 :(得分:0)

尝试使用侧边栏导航(请注意浮动属性):

这在您的CSS文件中

   menu-item alpha {float: left;}  

并在PHP / ASP / HTML页面中显示:

  <table border="1" align="right" style="float:right;">

答案 1 :(得分:0)

将浮动添加到<nav>而不是menu-item,否则两个菜单块将并排:

CSS -

nav { 
   float: left;
}

table { 
   float: right;
}