【问题标题】:Using div style cannot make border display使用div样式不能做边框显示
【发布时间】:2017-06-20 07:27:22
【问题描述】:

我的 WordPress 网站上有此代码用于 MailChimp 选项,但由于某种原因边框突然消失了,您能看看我可能遗漏了什么吗?

<div style="border-style: solid thin #FFFFFF">
  <p style="float:left; padding: 0px 5px 0px 0px;"><img src="http://www.xxxx.com/wp-content/uploads/2017/06/photo.jpg" style="width:115px; height:auto;" class="border"></p>
  <p><text 
  </p> 
  &nbsp;

  <!-- Begin MailChimp Signup Form -->
  <link href="//cdn-images.mailchimp.com/embedcode/horizontal-slim-10_7.css" rel="stylesheet" type="text/css">
  <style type="text/css">
    #mc_embed_signup{background:#FFFFFF; clear:left; font:14px Helvetica,Arial,sans-serif; width:100%;}
    /* Add your own MailChimp form style overrides in your site stylesheet or in this style block.
    We recommend moving this block and the preceding CSS link to the HEAD of your HTML file. */
  </style>
  <div id="mc_embed_signup">
    <form action="//xxxxxxx.us14.list-manage.com/subscribe/post?u=2b24d9a7eb0e64eed113ca92c&amp;id=6444b29c17" method="post" id="mc-embedded-subscribe-form" name="mc-embedded-subscribe-form" class="validate" target="_blank" novalidate>
      <div id="mc_embed_signup_scroll">
        <label for="mce-EMAIL">Subscribe to our mailing list</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;" aria-hidden="true"><input type="text" name="b_2b24d9a7eb0e64eed113ca92c_6444b29c17" tabindex="-1" value=""></div>
        <div class="clear"><input type="submit" value="Subscribe" name="subscribe" id="mc-embedded-subscribe" class="button"></div>
      </div>
    </form>
  </div>

【问题讨论】:

  • 你上面的代码有一些错误,不知道你原来的代码有没有同样的错误,可能想看看

标签: html css


【解决方案1】:

边框样式不接受颜色,也不接受“细”作为值。

您想在尝试使用的上下文中使用“边框”:

<div style="border: solid thin #FFFFFF">
  hello
</div>

https://jsfiddle.net/4tm3d1jm/

不过,您的 div 元素可能会被其他样式覆盖(或边框:无),但会将边框(或边框:无)应用于文档中的所有 div 元素。

参考:https://developer.mozilla.org/en-US/docs/Web/CSS/border-style?v=control

【讨论】:

    【解决方案2】:

    用途:

    <div style= 'border: 2px solid #fff'>
    

    而不是你的 div

    我希望:

    #mc_embed_signup{background:#FFFFFF; clear:left; font:14px Helvetica,Arial,sans-serif; width:100%;}
    

    在样式标签之间

    <style>#mc_embed_signup{background:#FFFFFF; clear:left; font:14px Helvetica,Arial,sans-serif; width:100%;}</style>
    

    如果没有,它将无法正常工作。样式必须在 css 文件中或标签之间应用。 另外,我希望您记住 CSS 层次结构 (CSS Selector Hierarchy?)

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2016-02-19
      • 2016-11-21
      • 2012-06-11
      • 1970-01-01
      • 2015-02-12
      • 1970-01-01
      • 2022-08-23
      • 1970-01-01
      相关资源
      最近更新 更多