html - CSS 更改输入之间的间距

标签 html css

我正在使用来自 purecss.io 的一些代码创建一些外观优雅的表格。我也在使用 this code为我的表单设置一个简单的评分系统。

但是,当我将两者结合在一起时,由于来自 purecss.io 的 CSS,评级上的间距看起来非常间隔

如何固定间距?

代码如下:

<link rel="stylesheet" href="http://yui.yahooapis.com/pure/0.6.0/pure-min.css">
<form action="" method="post" class="pure-form pure-form-aligned">
    <fieldset>
        <div class="pure-control-group">
            <label for="foo">Supercalifragilistic Label</label>
            <input id="foo" type="text" placeholder="Enter something here...">
        </div>

        <div class="pure-control-group">
            <label for="foo">Rating</label>
            <div class="acidjs-rating-stars">
                <input type="radio" name="group-1" id="group-1-0" value="5" /><label for="group-1-0"></label><!--
                --><input type="radio" name="group-1" id="group-1-1" value="4" /><label for="group-1-1"></label><!--
                --><input type="radio" name="group-1" id="group-1-2" value="3" /><label for="group-1-2"></label><!--
                --><input type="radio" name="group-1" id="group-1-3" value="2" /><label for="group-1-3"></label><!--
                --><input type="radio" name="group-1" id="group-1-4"  value="1" /><label for="group-1-4"></label>
            </div>
        </div>

        <div class="pure-controls">
            <label for="cb" class="pure-checkbox">
                <input id="cb" type="checkbox"> I've read the terms and conditions
            </label>
        <input name="SubmitButton" type="submit" class="pure-button pure-button-primary">Submit</button>

        </div>
    </fieldset>

</form>

我的页面是这样的:

enter image description here

最佳答案

我看到其他答案包括对 !important 语句的建议,所以我决定发布我的答案。我将您提供的代码放入 codepen.io 并进行了一些快速更改,看看这是否是您要找的。

我将类“评分者”添加到您的标记中并使用它设置了样式。

<div class="pure-control-group raters">
  <label for="foo">Rating</label>
  <div class="acidjs-rating-stars">

您可以在随附的注释中看到我添加这些样式规则的原因:

.raters label{
  float:left;       /* Corrective float for your modified code              */
}
.raters input{
  margin:0 0.25em; /* Spaces out the 'floated' radio inputs for presentation*/
}
.raters .acidjs-rating-stars label{ width:auto; } /* Actual Width Correction */

您可以在此处实时查看它的运行情况:http://codepen.io/anon/pen/vKNGpv

(注意:我在 CSS 面板设置中添加了雅虎的外部样式表。您可以通过右上角的齿轮访问它们。)*

关于html - CSS 更改输入之间的间距,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/37664721/

相关文章:

html - 跨浏览器链接到本地​​系统上的文件

html - 为什么关闭 1 像素边框会在固定位置标题和 Flex 增长的情况下产生 75 像素溢出?

javascript - "maxlength"不适用于 html 文本框中的输入类型 = "number"

html - 将 css 添加到 jsx react 脚本的最佳方法?

html - 如何对齐输入框

html - 列表项和嵌套子菜单列表之间的间隙导致悬停状态丢失

javascript - 从中间展开 <div>

html - 使一个 div 决定其他 div 的高度

javascript - window.resize() 函数并返回脚本执行的事实

php - 访客与登录用户的导航菜单 WP 样式