在背景图像周围包裹联系表格

时间:2013-09-08 13:21:55

标签: css html center

如何围绕背景图像(例如桌面屏幕)打包联系表单。如需进一步说明,请访问此link。向下滚动到页面底部,您将看到登录页面内的mac屏幕背景。

<div id="new_div_3">
        <form class="contact_form" action="#" method="post" name="contact_form">
            <ul>
                <li>
                    <h2>Contact Us</h2>
                    <span class="required_notification">* Denotes Required Field</span>
                </li>
                <li>
                    <label for="name">Name:</label>
                    <input type="text"  placeholder="John Doe" required />
                </li>
                <li>
                    <label for="email">Email:</label>
                    <input type="email" name="email" placeholder="john_doe@example.com" required />
                    <span class="form_hint">Proper format "name@something.com"</span>
                </li>
                <li>
                    <label for="website">Website:</label>
                    <input type="url" name="website" placeholder="http://johndoe.com" required pattern="(http|https)://.+"/>
                    <span class="form_hint">Proper format "http://someaddress.com"</span>
                </li>
                <li>
                    <label for="message">Message:</label>
                    <textarea name="message" cols="40" rows="6" required ></textarea>
                </li>
                <li>
                    <button class="submit" type="submit">Submit Form</button>
                </li>
            </ul>
        </form>
    </div>

这是我目前在new_div_3中的内容。

#new_div_3 {
    margin:0 auto;
    width: 500px;
    background:#ECF0F1 url('img/email-screen.png') 0 0 no-repeat;
    background-size: 1040px 878px;
    padding: 38px 38px 267px;
}

是否有办法让背景显示正确,在div的中心添加了中心出现的联系表格?

1 个答案:

答案 0 :(得分:0)

我认为你正在寻找类似的东西:

background:#ECF0F1 url('img/email-screen.png') no-repeat center center;

如果您使用的是firefox或chrome,则可以使用inspect元素查看在您提供的示例中如何设置它。