php - 如何在彼此相邻的两个单选按钮之间添加间距

标签 php html css radio-button styling

我很难在彼此相邻的两个单选按钮之间添加间距。它们靠得太近了,我觉得如果我在它们之间增加一些间距,它看起来会好很多。我说的是宽度,而不是它们的高度。

我试过添加填充和边距。我不太确定如何在两者之间添加间距。

<div class="style" style="width 100px; float:left; height 100px; margin:0px;">
<!-- this code asks the suer what clothing style they like. They have a lot of options. The code is like the gender code -->
Select a style: <br /> 
<label> <input type="radio" name="style" value="Casual" 
<?php 
if ($_POST['style'] == 'Casual') {
        echo "checked";
}
?>
/>Casual</label><br />

<label> <input type="radio" name="style" value="Athletic" 
<?php 
if ($_POST['style'] == 'Athletic') {
        echo "checked";
}
?>
/>Athletic</label><br />

<label> <input type="radio" name="style" value="Vintage" 
<?php 
if ($_POST['style'] == 'Vintage') {
        echo "checked";
}
?>
/>Vintage</label><br />

<label> <input type="radio" name="style" value="Formal" 
<?php 
if ($_POST['style'] == 'Formal') {
        echo "checked";
}
?>
/>Formal</label><br />

<label> <input type="radio" name="style" value="Streetwear" 
<?php 
if ($_POST['style'] == 'Streetwear') {
        echo "checked";
}
?>
/>Streetwear</label><br />

<label> <input type="radio" name="style" value="Rocker" 
<?php 
if ($_POST['style'] == 'Rocker') {
        echo "checked";
}
?>
/>Rocker</label>
</div>


<?php
if(($_POST['size'] == NULL) && ($_SERVER['REQUEST_METHOD'] == 'POST')){
    echo "<strong>Please select a clothing size!</strong><br />";
}
?>

<div class="size" style="width 100px; float:left; height 100px; margin:0px;">
Select a size: <br />

<label> <input type="radio" name="size" value="Extra Small" 
<?php 
if ($_POST['size'] == 'Extra Small') {
        echo "checked";
}
?>
/>Extra Small</label><br />

<label> <input type="radio" name="size" value="Small" 
<?php 
if ($_POST['size'] == 'Small') {
        echo "checked";
}
?>
/>Small</label><br />

<label> <input type="radio" name="style" value="Medium" 
<?php 
if ($_POST['size'] == 'Medium') {
        echo "checked";
}
?>
/>Medium</label><br />

<label> <input type="radio" name="size" value="Large" 
<?php 
if ($_POST['size'] == 'Large') {
        echo "checked";
}
?>
/>Large</label><br />

<label> <input type="radio" name="size" value="Extra Large" 
<?php 
if ($_POST['size'] == 'Extra Large') {
        echo "checked";
}
?>
/>Extra Large</label><br />

<label> <input type="radio" name="size" value="2X Large" 
<?php 
if ($_POST['size'] == '2X Large') {
        echo "checked";
}
?>
/>2X Large</label>
</div>

我想知道如何在两个单选按钮之间添加间距,使它们不会彼此非常靠近。我没有向 div 类添加任何 css。这是它现在的样子:mycode

最佳答案

只需在您的第一个 div 上应用 margin-right: 50px;(更改值以适合您的需要)

<div class="style" style="width 100px; float:left; height 100px; margin-right: 50px;">

关于php - 如何在彼此相邻的两个单选按钮之间添加间距,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/54739057/

相关文章:

javascript - 长轮询或全双工连接?问题在哪里?

javascript - 将 json 数据从 PHP 传递到 javascript - Google 饼图

css - 不能在同一行显示list和h1标签

javascript - 如何使用querySelector检索div第一个子元素同级节点?

html - 如何使用angular 5根据屏幕分辨率设置动态div高度

php - 发送 POST 数组和内存泄漏

javascript - 从 Web 服务器的 HTML 资源中播放 FLAC

html - 背景大小不适用于 IE8

html - CSS3 ASP HTML 不工作

google-chrome - 背景大小 :100% 100%; doesn't work properly in Chrome