微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

html – 对齐复选框旁边的文本

简单的问题,毫无疑问是一个简单的解决方案 – 尽管在搜索SO和谷歌一段时间后,我仍然很难找到它.

我所要做的就是获取文字片段“我对增强的列表或高级档案感兴趣,(我们团队的一名成员将及时回复更多信息)”并将其与支票右侧对齐框(文字左对齐),但不像现在一样环绕它.

这是我的JSFiddle

代码(使用PureCSS进行样式设计):

<form class="pure-form pure-form-aligned">
                    <fieldset>
                        <div class="pure-control-group">
                            <label for="name">Product Name</label>
                            <input id="name" type="text" placeholder="Username">
                        </div>

                        <div class="pure-control-group">
                            <label for="password">Contact Name</label>
                            <input id="password" type="text" placeholder="Password">
                        </div>

                        <div class="pure-control-group">
                            <label for="email">Contact Email</label>
                            <input id="email" type="email" placeholder="Email Address">
                        </div>

                        <div class="pure-control-group">
                            <label for="foo">Website</label>
                            <input id="foo" type="text" placeholder="Enter something here...">
                        </div>

                        <div class="pure-control-group">
                            <label for="foo">Description:</label>
                            <textarea id="description" type="text" placeholder="Enter description here..."></textarea>
                        </div>                      

                        <div class="pure-controls">
                            <label for="cb" class="pure-checkBox">
                                <input id="cb" type="checkBox">
                                I'm interested in an enhanced listing or premium profile,(a member of our team will respond promptly with further information)
                            </label>

                            <button type="submit" class="pure-button pure-button-primary">Submit</button>
                        </div>
                    </fieldset>
                </form>

任何帮助将非常感激.谢谢.

解决方法

这是一个简单的方法.可能还有其他人.
<input id="cb" type="checkBox" style="float: left; margin-top: 5px;>">
<div style="margin-left: 25px;">
     I'm interested in an enhanced listing or premium profile,(a member of our team will respond promptly with further information)
</div>

我使用div来“阻止”构造文本并将其移动到右侧.浮动:输入左侧保留复选框文本左侧(不在上方).输入上的margin-top调整顶部对齐文本.

fiddle.

原文地址:https://www.jb51.cc/html/226453.html

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。

相关推荐