[英]CSS styles not applied to Mailchimp form
我已经为我的 WP 网站编辑了嵌入式 Mailchimp 表单的样式。 但是,当我将更改应用到我网站的footer.php
和style.css
时,表单看起来完全没有样式:
这是一个小提琴,您可以在其中看到我打算应用的表单的样式。
您还可以在此处查看代码:
/* Changes the style of the overall form */ #mc_embed_signup { background: #c2cdc8; color: #000000; padding: 45px; text-align: center; } /* Styles the header text above the inputs */ #inscripcion { font-size: 18px; font: Poppins, sans-serif; margin: 0 0 20px; color: #000000; text-align: center; } #mc_embed_signup form { text-align: center; padding: 10px 0 10px 0; }.mc-field-group { display: inline-block; } /* positions input field horizontally */ #mc_embed_signup input.email { font-family: Poppins, sans-serif; border: none; padding: 15px; width: 50%; font-size: 16px; margin-right: 0px; -webkit-border-radius: 0px; -moz-border-radius: 0px; border-radius: 5px; color: #343434; background-color: #fff; box-sizing: border-box; display: inline-block; } #mc_embed_signup input.email:focus { outline-color: #FAE105; } #mc_embed_signup label { display: none; font-size: 16px; padding-bottom: 10px; font-weight: bold; } #mc_embed_signup.clear { display: inline-block; } #mc_embed_signup.button { background-color: #224b37; color: #ffffff; font-weight: bold; margin: 0 auto; border: none; padding: 15px 30px; border-radius: 5px; letter-spacing: 1px; font-size: 16px; box-shadow: 0px 8px 15px rgba(0, 0, 0, 0.1); cursor: pointer; box-sizing: border-box; display: inline-block; margin-left: 2px; transition: all 0.23s ease-in-out 0s; } #mc_embed_signup.button:hover { cursor: pointer; } #mc_embed_signup div#mce-responses { float: left; top: -1.4em; padding: 0em.5em 0em.5em; overflow: hidden; width: 90%; margin: 0 5%; clear: both; } #mc_embed_signup div.response { margin: 1em 0; padding: 1em.5em.5em 0; font-weight: bold; float: left; top: -1.5em; z-index: 1; width: 80%; } #mc_embed_signup #mce-error-response { display: none; } #mc_embed_signup #mce-success-response { color: #529214; display: none; } #mc_embed_signup label.error { display: block; float: none; width: auto; margin-left: 1.05em; text-align: left; padding: .5em 0; } @media (max-width: 768px) { #mc_embed_signup input.email { width: 100%; margin-bottom: 5px; } #mc_embed_signup.clear { display: block; width: 100%; } #mc_embed_signup.button { width: 100%; margin: 0; } }
<div id="mc_embed_signup"> <form action="https://imthemoisturizer.us19.list-manage.com/subscribe/post?u=13cc95dc908756ea974c0f4fb&id=78f2b1b6c1" method="post" id="mc-embedded-subscribe-form" name="mc-embedded-subscribe-form" class="validate" target="_blank" novalidate> <div id="mc_embed_signup_scroll"> <div id="inscripcion">¿Quieres recibir todos mis posts? ⦙ Do you want to receive my posts?</div> <input type="email" value="" "style=background:#FFFFFF;" name="EMAIL" class="email" id="mce-EMAIL" placeholder="email" required> <:-- real people should not fill this in and expect good things - do not remove this or risk form bot signups--> <div style="position; absolute: left; -5000px;" aria-hidden="true"><input type="text" name="b_13cc95dc908756ea974c0f4fb_78f2b1b6c1" tabindex="-1" value=""></div> <div class="clear"><input type="submit" value="OK!" name="subscribe" id="mc-embedded-subscribe" class="button"></div> </div> </form> </div>
这段代码有什么问题? 一定有什么东西阻止了所有 styles,但我看不到是什么。
提前非常感谢。
For some reason, if I included the HTML on footer.php
and the CSS on style.css
, the styles didn't properly load and the form had an awful appearance.
也许这不是一个整洁或干净的解决方案,但它可以工作,现在我的 Mailchimp 表单样式正确。 我只是简单地将 styles 包含在表单的div
开头,现在它们看起来很流畅。 我用这段代码做到了,包含在footer.php
:
<!-- Begin Mailchimp Signup Form -->
<div id="mc_embed_signup">
<style>
/* Changes the style of the overall form */
#mc_embed_signup {
background: #c2cdc8;
color: #000000;
padding: 45px;
text-align: center;
}
/* Styles the header text above the inputs */
#inscripcion {
font-size: 16px;
font: Poppins,sans-serif;
font-weight: 600;
margin: 0 0 20px;
color: #000000;
text-align: center;
}
#mc_embed_signup form {
text-align: center;
padding: 10px 0 10px 0;
}
.mc-field-group {
display: inline-block;
} /* positions input field horizontally */
#mc_embed_signup input.email {
font-family: Poppins,sans-serif;
border: none;
padding: 15px;
width: 50%;
font-size: 14px;
margin-right: 5px;
-webkit-border-radius: 0px;
-moz-border-radius: 0px;
border-radius: 5px;
color: #343434;
background-color: #fff;
box-sizing: border-box;
display: inline-block;
}
#mc_embed_signup input.email:focus {
outline-color: #FAE105;
}
#mc_embed_signup label {
display: none;
font-size: 16px;
padding-bottom: 10px;
font-weight: bold;
}
#mc_embed_signup .clear {
display: inline-block;
}
#mc_embed_signup .button {
background-color: #224b37;
color: #ffffff;
font: Poppins, sans-serif;
font-weight: bold;
margin: 0 auto;
border: none;
padding: 0 30px;
border-radius: 5px;
letter-spacing: 1px;
font-size: 14px;
box-shadow: 0px 8px 15px rgba(0, 0, 0, 0.1);
cursor: pointer;
box-sizing: border-box;
display: inline-block;
margin-left: 2px;
transition: all 0.23s ease-in-out 0s;
}
#mc_embed_signup .button:hover {
cursor: pointer;
}
#mc_embed_signup div#mce-responses {
float: left;
top: -1.4em;
padding: 0em .5em 0em .5em;
overflow: hidden;
width: 90%;
margin: 0 5%;
clear: both;
}
#mc_embed_signup div.response {
margin: 1em 0;
padding: 1em .5em .5em 0;
font-weight: bold;
float: left;
top: -1.5em;
z-index: 1;
width: 80%;
}
#mc_embed_signup #mce-error-response {
display: none;
}
#mc_embed_signup #mce-success-response {
color: #529214;
display: none;
}
#mc_embed_signup label.error {
display: block;
float: none;
width: auto;
margin-left: 1.05em;
text-align: left;
padding: .5em 0;
}
@media (max-width: 768px) {
#mc_embed_signup input.email {
width: 100%;
margin-bottom: 5px;
}
#mc_embed_signup .clear {
display: block;
width: 100%;
}
#mc_embed_signup .button {
width: 100%;
margin: 0;
}
}
</style>
<form action="HERE GOES THE LINK TO YOUR MAILCHIMP FORM" method="post" id="mc-embedded-subscribe-form" name="mc-embedded-subscribe-form" class="validate" target="_blank" novalidate>
<div id="mc_embed_signup_scroll">
<div id="inscripcion">¿Quieres recibir todos mis posts? ⦙ Do you want to receive my posts?</div>
<input type="email" value="" "style=background:#FFFFFF;" name="EMAIL" class="email" id="mce-EMAIL" placeholder="email" required>
<!-- real people should not fill this in and expect good things - do not remove this or risk form bot signups-->
<div style="position: absolute; left: -5000px;" aria-hidden="true"><input type="text" name="b_13cc95dc908756ea974c0f4fb_78f2b1b6c1" tabindex="-1" value=""></div>
<div class="clear"><input type="submit" value="OK!" name="subscribe" id="mc-embedded-subscribe" class="button"></div>
</div>
</form>
</div>
<!--End mc_embed_signup-->
更改它以使其适应您的需求和偏好并且它应该可以工作,尽管我不能保证它是一个干净的解决方案。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.