gpt4 book ai didi

html - 将 Bootstrap 网格应用于 RadioButtonList 的 ListItem

转载 作者:行者123 更新时间:2023-11-28 15:12:50 25 4
gpt4 key购买 nike

我想将 Bootstrap 网格应用于 RadioButtonList 的 ListItem:

 Col-md-12
+-------------------------------------------------------------------+
| Col-md-2 Col-md-2 Col-md-2 Col-md-2 Col-md-2 |
| +--------+ +--------+ +--------+ +--------+ +--------+ |
| | O rb1 | | O rb2 | | O rb3 | | O rb4 | | O rb5 | |
| +--------+ +--------+ +--------+ +--------+ +--------+ |
+-------------------------------------------------------------------+

我的 RadioButtonList 是:

<div class="col-md-12">
<asp:RadioButtonList ID="rblCleanliness" RepeatDirection="Horizontal" runat="server">
<asp:ListItem Value="1">rb1</asp:ListItem>
<asp:ListItem Value="2">rb2</asp:ListItem>
<asp:ListItem Value="3">rb3</asp:ListItem>
<asp:ListItem Value="4">rb4</asp:ListItem>
<asp:ListItem Value="5">rb5</asp:ListItem>
</asp:RadioButtonList>
</div>

如何将 col-md-2 应用于 RadioButtonList 的每个 ListItem?

<div class="col-md-2">
<asp:ListItem Value="1">rb1</asp:ListItem>
</div>

更新:

我正在寻找的结果:

enter image description here

最佳答案

使用 CSS 来显示它们 flex:

#rblCleanliness{
background-color:green;
border: solid 2px black;
height: 400px;
width:400px;
display: flex;
}
.col-md-12{
width: 1000px;
height: 400px;
display: flex;
flex-direction: row;
justify-content: center;
}

.box{
border:dashed 2px black;
display: flex;
flex-grow: 1;
}

你的 html 应该有类似

的类
<div class="col-md-12">
<asp:RadioButtonList ID="rblCleanliness" RepeatDirection="Horizontal" runat="server">
<asp:ListItem Value="1" class="box 1">rb1</asp:ListItem>
<asp:ListItem Value="2" class="box 2">rb2</asp:ListItem>
<asp:ListItem Value="3" class="box 3">rb3</asp:ListItem>
<asp:ListItem Value="4" class="box 4">rb4</asp:ListItem>
<asp:ListItem Value="5" class="box 5">rb5</asp:ListItem>
</asp:RadioButtonList>
</div>

对于 Bootstrap 版本将

#rblCleanliness{
background-color:white;
border: solid 2px black;
height: 400px;
width:400px;
display:flex;
justify-content: space-around;

}

.col-md-12{
width: 1000px;
height: 400px;

}

.box{
border:dashed 2px black;
}

Bootstrap html 将是:

<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css" integrity="sha384-BVYiiSIFeK1dGmJRAkycuHAHRg32OmUcww7on3RYdg4Va+PmSTsz/K68vbdEjh4u" crossorigin="anonymous">
</head>
<body>
<div class="row col-md-12">
<asp:RadioButtonList ID="rblCleanliness" RepeatDirection="Horizontal" runat="server">
<asp:ListItem Value="1" class="box col-md-2 1">rb1</asp:ListItem>
<asp:ListItem Value="2" class="box col-md-2 2">rb2</asp:ListItem>
<asp:ListItem Value="3" class="box col-md-2 3">rb3</asp:ListItem>
<asp:ListItem Value="4" class="box col-md-2 4">rb4</asp:ListItem>
<asp:ListItem Value="5" class="box col-md-2 5">rb5</asp:ListItem>
</asp:RadioButtonList>
</div>
</body>

关于html - 将 Bootstrap 网格应用于 RadioButtonList 的 ListItem,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/47954476/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com