gpt4 book ai didi

html - CSS:如何将单选按钮与图例对齐?

转载 作者:行者123 更新时间:2023-11-28 16:20:02 27 4
gpt4 key购买 nike

我有一个表单,但我的图例没有与单选按钮对齐。我该怎么做?

我需要将 legen 标签与单选按钮对齐。像这个例子:

enter image description here

我有什么:

enter image description here

我已经对齐了单选按钮,但没有对齐它们的图例。我需要每个图例的第一个字母与单选按钮对齐。就像图片示例中一样。

CSS:(对齐单选按钮):

ul, li {
list-style-type: none;
}


ul.form-items li {
display: flex; !important;
justify-content: space-between; !important;
width: 200px; !important;
text-align: left; !important;
}

HTML:

    <form action="/post_url_tamanioscantidades/" method="post">
<input type="hidden" name="csrfmiddlewaretoken" value="Phabzw1RqbPnGf2wKo4zoHqWLXogOcfbFR38uxXLeoHeBigRBXhXqO0q9mhFimsB">

<div id="tamanios">
<legend> Selecciona un tamaño</legend>
<ul>
<li>
<span>
<input type="radio" name="tamanios" value="2x2" id="id_tamanios_0" required>
2&quot; x 2&quot; </span>
</li>
<li>
<span>
<input type="radio" name="tamanios" value="3x3" id="id_tamanios_1" required>
3&quot; x 3&quot;
</span>
</li>
<li>
<span>
<input type="radio" name="tamanios" value="4x4" id="id_tamanios_2" required>
4&quot; x 4&quot;
</span>
</li>
<li>
<span>
<input type="radio" name="tamanios" value="5x5" id="id_tamanios_3" required>
5&quot; x 5&quot;
</span>
</li>
</ul>

</div>


<div id="cantidades">

<legend> Selecciona la cantidad</legend>

<ul>
<li>
<span>
<input type="radio" name="cantidades" value="100" id="id_cantidades_0" required>
50
</span> <span>$69</span>
<span class="savings">Ahorra 39%</span>
</li>
<li>
<span>
<input type="radio" name="cantidades" value="100" id="id_cantidades_1" required>
100 </span>
<span>$120</span>
<span class="savings">Ahorra 77%</span>
</li>
<li>
<span>
<input type="radio" name="cantidades" value="150" id="id_cantidades_2" required>
150
</span>
<span>$509</span>
<span class="savings">Ahorra 60%</span
</li>
</ul>

</div>

<input type="submit" value="Submit"/>
</form>

最佳答案

尝试将 ul 中的填充设置为 0

ul { padding-left: 0; } 

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

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