【问题标题】:How do I place a form on top of an image and have it resize correctly in CSS?如何在图像上放置表单并在 CSS 中正确调整大小?
【发布时间】:2012-05-17 08:44:53
【问题描述】:

我正在尝试创建一个自定义小部件,该小部件将通过电子邮件表单订阅的 Feedburner 放置在响应式主题中的图像(背景)之上。现在我用于背景的图像没有正确显示。小部件现在主要有两个问题。一,图像在小部件本身内没有正确调整大小。第二,当浏览器调整大小时,背景图片没有正确调整大小。

如果您一直向下滚动到this page 侧边栏的底部,您可以看到我正在处理的自定义小部件。

这是我用来创建小部件的代码。

<form style="border:1px solid #ccc;padding:3px;text-align:center;background: url(http://wpdallas.com/plain/wp-content/uploads/2012/04/noah-side-bar.jpg);" action="http://feedburner.google.com/fb/a/mailverify" method="post" target="popupwindow" onsubmit="window.open('http://feedburner.google.com/fb/a/mailverify?uri=noahsdad', 'popupwindow', 'scrollbars=yes,width=550,height=520');return true">
    <p>
        <input type="text" style="width:200px;height:20px;" name="email" onblur="if (this.value == '') {this.value = 'Enter your email address';}" onfocus="if (this.value == 'Enter your email address') {this.value = '';}" value="Enter your email address"/>
    </p>
    <input type="hidden" value="noahsdad" name="uri"/><input type="hidden" name="loc" value="en_US"/>
    <input type="submit" value="Subscribe" />

【问题讨论】:

    标签: css responsive-design


    【解决方案1】:

    您应该为表单尝试这个样式表,并且在每个显示分辨率上都看起来不错。

    border: 1px solid #CCC;
    padding: 3px;
    text-align: center;
    background: #f09e30 url(http://wpdallas.com/plain/wp-content/uploads/2012/04/noah-side-bar.jpg) no-repeat left bottom;
    padding: 35% 0;
    

    【讨论】:

    • 非常感谢您的帮助。我插入了您的代码,但图像的尺寸仍然不正确。背景图像未正确调整大小。这是我页面的链接,您可以在侧边栏的底部看到小部件(带有您在上面发布的代码)。我还在侧边栏的最顶部使用了相同的图像(但没有表单),这样您就可以看到原始图像的样子。
    猜你喜欢
    • 2021-11-05
    • 2014-07-08
    • 1970-01-01
    • 1970-01-01
    • 2011-03-26
    • 1970-01-01
    • 1970-01-01
    • 2020-06-15
    • 1970-01-01
    相关资源
    最近更新 更多