如何在 asp c# 上将中继器按钮排成一行

how to put a repeater buttons in a row on asp c#

我有这段代码可以制作带中继器的按钮,它可以工作,但我不能把它们排成一行,即使我添加了 !important,我在 css 中添加的所有代码都会被 ovride。我添加了我写的 css 它改变了元素的样式,但它在一列中显示它们。

<asp:Repeater ID="Repeater1" runat="server">
    <ItemTemplate runat="server">
        <ul class="menue" runat="server">
            <li><a>
                <asp:Label runat="server" ID="Label1"
                    Text='<%# Eval("_name") %>' CommandArgument='<% Eval("_url") %>' />
            </a></li>
        </ul>
    </ItemTemplate>
</asp:Repeater>

和 css

    .menue{
      list-style: none;
      margin: 0; 
      background: #17212B;
      display: -webkit-box;
      display: -moz-box;
      display: -ms-flexbox;
      display: flex;
      border-bottom:solid;
      border-width:1px;
      border-color: #2F3943;
      -webkit-flex-flow: row wrap;
      justify-content: flex-end;
    }

    .menue a {
      text-decoration: none;
      display: block;
      padding: 0.4em;
      color: white;
    }
        .menue a {
            font-weight: bold;
            padding:1.8em;
            border-right:solid;
            border-width:1px;
            border-color: #2F3943;
        }
        .menue a .selected {
            padding:2em;
        }

试试这个作为你的 CSS。最重要的是 display: inline-block

.menue {
    list-style: none;
    margin: 0px;
    background: #17212B;
    border: 1px solid #2F3943;
    display: inline-block; 
}

要使 CommandArgument 正常工作,您需要添加 #

CommandArgument='<%# Eval("_url") %>'