如何在ASP.NET MVC中使用两个嵌入式单选按钮

时间:2019-03-11 04:21:40

标签: asp.net-mvc

我试图在ASP.NET MVC中有两个嵌入式单选按钮,但标签及其对应的单选按钮彼此不对齐。                                 {条款和条件在这里}

<label class="radio-inline">
    <input type="radio" name="Terms" value="Yes" />Yes
</label>
<label class="radio-inline">
    <input type="radio" name="Terms" value="No" />No
</label>

但我的结果does not have the radio button and the label together

1 个答案:

答案 0 :(得分:1)

将它们都放入一个div标签

<!DOCTYPE html>
<html>
<head>
<title>Page Title</title>
</head>
<body>
<div>
<label class="radio-inline">
    <input type="radio" name="Terms" value="Yes" />Yes
</label>
<label class="radio-inline">
    <input type="radio" name="Terms" value="No" />No
</label>
</div>
</body>
</html>