" > -6ren">
gpt4 book ai didi

html - CSS - 如何对齐我的单选按钮?

转载 作者:行者123 更新时间:2023-11-27 23:27:54 25 4
gpt4 key购买 nike

这是我的 HTML 表单代码:

<div id="myForm">
<form action="<?php echo $__SERVER["PHP_SELF"];?>" method="post">
<table>
<input type="radio" name="tableNames" value="<?php echo $tempName; ?>" > <?php echo $tempName ?> <br/>

<tr>
<td><input type="submit" value="submit"></td>
<td><input type="reset" value="reset"></td>
</tr>
</table>
</form>
</div>

这是我当前的 CSS:

#myForm {
margin: auto;
width: 700px;
}
#myForm form {
background-color: #E0E0E0;
text-align: center;
padding: 5px;
}
#myForm table {
margin: auto;
width: 60%;
padding: 15px;
}

这是我的表单现在的样子: radio buttons我怎样才能对齐单选按钮的按钮

最佳答案

您可以将输入包装在一个 div 中,然后将该 div 居中并使其文本左对齐。

#myForm {
margin: auto;
width: 700px;
}
#myForm form {
background-color: #E0E0E0;
text-align: center;
padding: 5px;
}
#myForm table {
margin: auto;
width: 60%;
padding: 15px;
}
.test {
width: 300px;
margin: 0 auto;
text-align: left;
}
<div id="myForm">
<form method="post">
<table>
<div class="test">
<input type="radio" name="tableNames" value="asdasd123123">asdasdasd
<br/>
<input type="radio" name="tableNames" value="asd">asdasdasd
<br/>

<input type="radio" name="tableNames" value="asdasdasdas?>">123
<br/>
<input type="radio" name="tableNames" value="123123123123">asdasdasd1231231231231231231231
<br/>
</div>
<tr>
<td>
<input type="submit" value="submit">
</td>
<td>
<input type="reset" value="reset">
</td>
</tr>
</table>
</form>
</div>

关于html - CSS - 如何对齐我的单选按钮?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/37518677/

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