改变从垂直到水平的对齐方式

时间:2015-01-21 12:09:53

标签: c# asp.net alignment vertical-alignment

  <p style="text-align:left">
                      View Map <br />
                        <asp:DropDownList ID="ddlViewMapGroupName" runat="server"></asp:DropDownList>
                      </p>      

                      <p style="text-align:left">
                      Edit Map <br />
                        <asp:DropDownList ID="ddlEditMapGroupName" runat="server"></asp:DropDownList>
                      </p>

                      <p style="text-align:left">
                      Publish Map <br />
                        <asp:DropDownList ID="ddlPublishMapGroupName" runat="server"></asp:DropDownList>
                      </p>

所示:

View Map
//DDList

Edit Map
//DDList

Publish Map
//DDList

我想看起来像:

View Map  Edit Map  Publish Map
//DDList  //DDList  //DDList

有点像汽车吗?不确定任何帮助表示赞赏。 TA

2 个答案:

答案 0 :(得分:0)

您不希望将项目包装在段落标记中以构造它们,因为名称表示这些项目用于包装段落,而不是水平格式化。

相反,您更适合使用列表,这样您就可以轻松地将格式从垂直更改为水平。

所以你的HTML将是:

   <ul id="navlist">
    <li>
      <asp:DropDownList ID="ddlViewMapGroupName" runat="server">/asp:DropDownList>
    </li>
    <li>
    <asp:DropDownList ID="ddlEditMapGroupName" runat="server"></asp:DropDownList>
    </li>
    <li>
    <asp:DropDownList ID="ddlPublishMapGroupName" runat="server"></asp:DropDownList>
    </li>
    </ul>

你的CSS将是:

#navlist li
{
display: inline;
list-style-type: none;
padding-right: 10px;
}

这里的主要内容是:

display: inline;
list-style-type: none;

答案 1 :(得分:0)

这不是自动的。但是你可以写一个好的旧表并添加它:

<table>
  <tr>
    <td>
      <asp:DropDownList ID="ddlViewMapGroupName" runat="server"></asp:DropDownList>
    </td>
    <td>
      <asp:DropDownList ID="ddlEditMapGroupName" runat="server"></asp:DropDownList>
    </td>
    <td>
      <asp:DropDownList ID="ddlPublishMapGroupName" runat="server"></asp:DropDownList>
    </td>
  </tr>
  <tr>
    <td>
      View Map
    </td>
    <td>
      Edit Map
    </td>
    <td>
      Publish Map
    </td>
  </tr>
</table>