简体   繁体   English

设置mailchimp表单的样式

[英]Styling mailchimp forms

I'm trying to close the distance between the checkboxes and the labels. 我正在尝试关闭复选框和标签之间的距离。 I would like them to sit inline. 我希望他们排队。

CSS 的CSS

#mc_embed_signup_pro {
    background: #fff;
    width: 520px;
    padding: 40px;
    }
#mc_embed_signup_pro input {
    height: 38px;
    width: 510px !important;
    font-family: Arial;
    font-size: 22px;
    text-transform: bold;
    color: #666;
    border: 1px #a3a3a3 solid;
    -moz-border-radius: 12px;
    border-radius: 12px;
    float: left;
    clear: both;
    }
#mc-field-group li {
    float: left;
    width: 30px;
    height: 40px;
    }
.check {
    background: aqua;
    float: right !important;
    }
#mc_embed_signup_pro label {
    margin-top: 20px;
    margin-bottom: 8px;
    float: left;
    }
#mc_embed_signup_pro .mc-field-group {
    margin-bottom: 10px;
    height:60px;
    clear: both;
    }
#mc_embed_signup_pro .button {
    background: #484848 !important;
    float: left;
    padding-top:3px !important;
    font-size: 32px !important;
    line-height: 20px !important;
    width: 150px !important;
    height: 46px !important;
    font-family: 'Populaire';
    }

Live sample http://www.oatbook.co.uk/signup-pro.html 现场样本http://www.oatbook.co.uk/signup-pro.html

#mc_embed_signup_pro input has a style of width: 510px; #mc_embed_signup_pro inputwidth: 510px; , which is being applied to your input fields above as well as your input checkboxes. ,这将应用于上方的输入字段以及输入复选框。 You need to make a seperate style for your checkboxes so they can both have independent widths. 您需要为复选框制作单独的样式,以便它们都可以具有独立的宽度。

Also, not sure if you intended it, but on my browser your checkboxes are REALLY big and blurred, 38px x 38px 另外,不确定您是否打算这样做,但是在我的浏览器中,您的复选框非常大且模糊,为38px x 38px

edit: response to first comment 编辑:回应第一条评论

First, you have !important on assigned to the width of #mc_embed_signup_pro input imput tags. 首先,将!important分配给#mc_embed_signup_pro input imput标签的宽度。 !important will override any style no matter where it sits in your CSS, (even inline) so you will want to remove that. !important会覆盖任何样式,无论它在CSS中的位置如何(甚至是内联),因此您都希望将其删除。 There is a second one here you will need to remove: 这里需要删除第二个:

input {
    border-radius: 12px 12px 12px 12px;
    color: #666666;
    float: left;
    font-family: Arial;
    font-size: 15px;
    height: 8px;
    width: 220px !important;
    }

This is probably why you added the !important to the 510px width in the first place? 这可能就是为什么您首先将!important添加到510px宽度的原因? Next you'll want to actually add a class declaration to these bits 接下来,您实际上要向这些位添加一个类声明

<li>
    <input id="mce-group[1869]-1869-0" type="checkbox" name="group[1869][1]" value="1" class="checkbox">
    <label for="mce-group[1869]-1869-0" class="label">Medical Professional</label>
</li>

input.checkbox {
    width:20px; 
    float:right; 
    margin:0; 
    padding:0; 
    height:1em;
    }

input.label {
    width:200px; 
    float:left; 
    margin:0; 
    height: 1em;
    }

You are going to have some unecessary code here, though, because the styles from <input> and #mc_embed_signup_pro input are adding styles you don't want to the checkbox inputs. 但是,这里将有一些不必要的代码,因为<input>#mc_embed_signup_pro input中的样式#mc_embed_signup_pro input不需要的样式添加到复选框输入中。 The best thing you could do is put unique classes for each input type and style those instead of using the descendant selector #mc_embed_signup_pro input . 最好的办法是为每种输入类型放置唯一的类并为其设置样式,而不是使用后代选择器#mc_embed_signup_pro input By using input you are stying all input tags, not just the classes assigned to them. 通过使用input您可以设置所有输入标签的样式,而不仅仅是分配给它们的类。 The only styles that should be applied to input are the ones that are universally applicable. 唯一应应用于input样式是普遍适用的样式。 Otherwise you are writing styles, then overwriting them later rather than never having applied them at all. 否则,您就是在编写样式,然后在以后覆盖它们,而不是根本没有应用它们。

I hope this makes sense. 我希望这是有道理的。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM