代码之家  ›  专栏  ›  技术社区  ›  Steven J

Mail黑猩猩超瘦订阅表单-水平布局

  •  0
  • Steven J  · 技术社区  · 11 年前

    我想在960像素宽的响应magento网站上获得此表单,该网站的最小大小为320像素。

    我非常希望它的行为/风格与 VintageStyler -如果您加载页面并滚动到底部,您将看到一个用于电子邮件提交的新闻稿注册表单。我想让我的表格显示在一行中,并像这样做出反应。

    查看我的当前表单> The Signup Form -目前“3行”,我希望看到一个长水平格式,直到它出现在较小的屏幕上

    这是mailchimp提供的“超瘦”表单,包括所有样式,而不是从远程CSS中提取

    下面是我使用的代码

    <head>
    <!-- Begin MailChimp Signup Form -->
    <style type="text/css">
        #mc_embed_signup{/*background:#fff;*/ clear:left; font:14px Helvetica,Arial,sans-serif;  width:960px;}
    #mc_embed_signup form {display:block; position:relative; text-align:left; /*padding:10px 0 10px 3%*/}
    #mc_embed_signup h2 {font-weight:bold; padding:0; margin:15px 0; font-size:1.4em;}
    #mc_embed_signup input {border:1px solid #999; -webkit-appearance:none;}
    #mc_embed_signup input[type=checkbox]{-webkit-appearance:checkbox;}
    #mc_embed_signup input[type=radio]{-webkit-appearance:radio;}
    #mc_embed_signup input:focus {border-color:#333;}
    /* Button Code */#mc_embed_signup .button {clear:both; background-color: #aaa; border: 0 none; border-radius:4px; color: #FFFFFF; cursor: pointer; display: inline-block; font-size:15px; font-weight: bold; height: 32px; line-height: 32px; margin: 0 5px 10px 0; padding:0; text-align: center; text-decoration: none; vertical-align: top; white-space: nowrap; width: auto;}
    #mc_embed_signup .button:hover {background-color:#777;}
    #mc_embed_signup .small-meta {font-size: 11px;}
    #mc_embed_signup .nowrap {white-space:nowrap;}     
    #mc_embed_signup .clear {clear:none; display:inline;}
    
    #mc_embed_signup label {display:block; font-size:16px; padding-bottom:10px; font-weight:bold;}
    #mc_embed_signup input.email {display:block; padding:8px 0; margin:0 4% 10px 0; text-indent:5px; width:35%; min-width:130px;}
    #mc_embed_signup input.button {display:block; width:35%; margin:0 0 10px 0; min-width:90px;}
    
    #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;}
    </style>
    </head>
    <body>
    <div id="mc_embed_signup">
    <form action="#" method="post" id="mc-embedded-subscribe-form" name="mc-embedded-subscribe-form" class="validate" target="_blank" novalidate>
        <label for="mce-EMAIL">Stay Connected with Tuga Sunwear</label>
        <input type="email" value="" name="EMAIL" class="email" id="mce-EMAIL" placeholder="email address" 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;"><input type="text" name="#" tabindex="-1" value=""></div>
        <div class="clear"><input type="submit" value="Subscribe Now" name="subscribe" id="mc-embedded-subscribe" class="button"></div>
    </form>
    </div>
    </body>
    <!--End mc_embed_signup-->
    

    如果你想玩这个并在这里发帖,那就太棒了。我似乎无法理解为什么内联块和消除浮点数不能解决这个问题。

    再次感谢!

    1 回复  |  直到 11 年前
        1
  •  2
  •   ralph.m    11 年前

    你真的在寻找一个关于响应式设计的教程,所以我建议你仔细阅读其中的内容。但这里有一个你需要的基本示例: http://codepen.io/pageaffairs/pen/JDrhG

    <!DOCTYPE html>
    <html lang="en">
    <head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <style type="text/css">
        *, *:before, *:after {-moz-box-sizing: border-box; -webkit-box-sizing: border-box; box-sizing: border-box;}
        #mc_embed_signup{ clear:left; font:14px Helvetica,Arial,sans-serif; width: 80%; margin: 0 auto;}
        #mc_embed_signup form {display:block; position:relative; text-align:left;}
        #mc_embed_signup input {border:1px solid #999; -webkit-appearance:none;}
        #mc_embed_signup input:focus {border-color:#333;}
        #mc_embed_signup .button {clear:both; background-color: #aaa; border: 0 none; border-radius:4px; color: #FFFFFF; cursor: pointer; display: inline-block; font-size:15px; font-weight: bold; height: 32px; line-height: 32px; margin: 0 5px 10px 0; padding:0; text-align: center; text-decoration: none; vertical-align: top; white-space: nowrap; width: auto;}
        #mc_embed_signup .button:hover {background-color:#777;}
        #mc_embed_signup .small-meta {font-size: 11px;}
        #mc_embed_signup .nowrap {white-space:nowrap;}     
        #mc_embed_signup .clear {clear:none; display: inline-block; width: 31%; vertical-align: top;}
    
        #mc_embed_signup label {display:inline-block; font-size:16px; padding-bottom:10px; font-weight:bold; width: 31%;vertical-align: top;}
        #mc_embed_signup input.email {display:inline-block; padding:8px 0; margin:0 10px 10px 0; text-indent:5px; width:34%;vertical-align: top;}
        #mc_embed_signup input.button {display:block; width:100%; margin:0 0 10px 0;}
    
        @media screen and (max-width: 780px) {
            #mc_embed_signup {width: 100%;}
            #mc_embed_signup label, #mc_embed_signup input.email, #mc_embed_signup .clear {display: block; width: 100%;}
        }
    </style>
    </head>
    <body>
    <div id="mc_embed_signup">
        <form action="#" method="post" id="mc-embedded-subscribe-form" name="mc-embedded-subscribe-form" class="validate" target="_blank" novalidate>
            <label for="mce-EMAIL">Stay Connected with Tuga Sunwear</label>
            <input type="email" value="" name="EMAIL" class="email" id="mce-EMAIL" placeholder="email address" 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;">
                <input type="text" name="#" tabindex="-1" value="">
            </div>
            <div class="clear">
                <input type="submit" value="Subscribe Now" name="subscribe" id="mc-embedded-subscribe" class="button">
            </div>
        </form>
    </div>
    </body>
    

    不过,您需要将其与您的布局集成,因此需要进行更改。