Центр RadioButtonList внутри панели - PullRequest
3 голосов
/ 18 января 2012

Кажется, я не могу центрировать мой RadioButtonList внутри панели.Это всегда кажется оправданным.Неважно, что я пытаюсь.

Мой текущий код:

<asp:panel ID="Panel1" runat="server" CssClass="style8" Height="228px" 
  width="456px">
  <br /> 
         <p style ="text-align:center">
              <asp:Label ID+"Label2" runat="server" Text="Blah">
              </asp:Label>
        </p>
        <asp:RadioButtonList ID="AlertClients" runat="Server" TextAlign="Right" 
       style="list-style=center">
              <asp:ListItem> Option 1</asp:ListItem>
             <asp:ListItem> Option 2</asp:ListItem>
             <asp:ListItem> Option 3</asp:ListItem>
         </asp:RadioButtonList>
</asp:Panel>

Любая помощь будет высоко ценится.

Ответы [ 3 ]

4 голосов
/ 18 января 2012

Просто поместите этот тег в элемент управления списком кнопок-переключателей: align = "center"

<asp:RadioButtonList ID="AlertClients" runat="Server" TextAlign="Right" Style="list-style=center" align="center">
 <asp:ListItem> Option 1</asp:ListItem>
 <asp:ListItem> Option 2</asp:ListItem>
 <asp:ListItem> Option 3</asp:ListItem></asp:RadioButtonList>
1 голос
/ 18 января 2012

Могу поспорить, вам нужно отредактировать style8, на который ссылается панель, и добавить tex-align: center;

<style>
  .style8
      {
        text-align:center;
      }
 </style>
1 голос
/ 18 января 2012

На мой взгляд, используйте div вместо панели. Но, как и на панели, вы также можете попробовать дать

style="margin:auto;"
...